nameof returns the wrong result for static and instance variables that aren't builtins.
Numbered Steps to Reproduce Problem:
1. Create a variable on a type (static or not).
2. Try to get its name using nameof, as listed in the ref (e.g. foo.bar or foo::bar)
3. Get the wrong result, like "bounds_width" (index 15 in the vars list with no user-defined variables, btw) or "bounds_height" (index 16).
Code Snippet (if applicable) to Reproduce Problem:
/obj/var/foo
/obj/var/static/bar
/world/New()
var/obj/O = new()
world.log << nameof(O.foo)
world.log << nameof(/obj::bar)
Expected Results:
foo
bar
Actual Results:
bound_width
bound_height
Does the problem occur:
Every time? Or how often?
Every time you do this.
In other games?
If they do this.
In other user accounts?
Yes.
On other computers?
Yes.
When does the problem NOT occur?
When using nameof on procs, or on built-in variables like density.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Workarounds:
Don't use nameof() for user-created variables? :(