-
Notifications
You must be signed in to change notification settings - Fork 117
Local vars override built-in vars #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Local vars override built-in vars #2307
Conversation
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
# About the pull request <!-- Remove this text and explain what the purpose of your PR is. Mention if you have tested your changes. If you changed a map, make sure you used the mapmerge tool. If this is an Issue Correction, you can type "Fixes Issue #169420" to link the PR to the corresponding Issue number #169420. Remember: something that is self-evident to you might not be to others. Explain your rationale fully, even if you feel it goes without saying. --> OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames `var/mob/usr` to `var/mob/user`. # Explain why it's good for the game This pragma is currently set as an error in CM, because using internal var names for declared var names is cringe. # Changelog it's a var rename
## About The Pull Request OpenDream is adding `usr` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames a `var/mob/usr` to `var/mob/user`. ## Why It's Good For The Game This pragma is currently an error on TG, because using internal var names for declared var names is cringe.
## About The Pull Request OpenDream is adding `usr` and `args` to the `SoftReservedKeyword` pragma: OpenDreamProject/OpenDream#2307 This PR renames `var/usr` to `var/user` and `var/args` to `var/arguments`. ## Why It's Good For The Game This pragma is currently set as an error on Aurora, because using internal var names for declared var names is cringe.
I think it would be better to emit the warning on their definition rather than their use. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@@ -327,6 +327,9 @@ | |||
var valType = AsComplexTypes() ?? DMValueType.Anything; | |||
var varDef = new DMASTObjectVarDefinition(loc, varPath, value, valType); | |||
|
|||
if (varDef.IsStatic && varDef.Name is "usr" or "src" or "args" or "world" or "global" or "callee" or "caller") |
Check notice
Code scanning / InspectCode
Merge null/pattern checks into complex pattern Note
if you define a proc arg or local with a name of
usr
orsrc
orargs
, further references to it in this context will refer to the local value and not the built-inThis now throws a
SoftReservedKeyword
compiler error, which causes Goon to fail to build and probably will for a bunch of other codebases. Probably worth an announcement.Fixes #2306
Fixes #1138
Also changes CI so test codebases are compiled in parallel