ID:2849323
 
Resolved
The nameof() operator didn't work correctly for vars that weren't built in.
BYOND Version:515.1596
Operating System:Linux
Web Browser:Firefox 108.0
Applies to:Dream Maker
Status: Resolved (515.1599)

This issue has been resolved.
Descriptive Problem Summary:
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? :(

Lummox JR resolved issue with message:
The nameof() operator didn't work correctly for vars that weren't built in.