Skip to content

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

amylizzle
Copy link
Collaborator

@amylizzle amylizzle commented Jun 13, 2025

if you define a proc arg or local with a name of usr or src or args, further references to it in this context will refer to the local value and not the built-in

This 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

@boring-cyborg boring-cyborg bot added the Compiler Involves the OpenDream compiler label Jun 13, 2025
MrMelbert pushed a commit to tgstation/tgstation that referenced this pull request Jun 14, 2025
## 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.
twilightwanderer pushed a commit to Alliance-Station/Alliance-Station that referenced this pull request Jun 14, 2025
## 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.
TealSeer pushed a commit to effigy-se/effigy that referenced this pull request Jun 14, 2025
## 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.
vinylspiders pushed a commit to NovaSector/NovaSector that referenced this pull request Jun 15, 2025
## 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.
vinylspiders pushed a commit to NovaSector/NovaSector that referenced this pull request Jun 15, 2025
## 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.
github-merge-queue bot pushed a commit to cmss13-devs/cmss13 that referenced this pull request Jun 15, 2025
# 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
TealSeer pushed a commit to Bubberstation/Bubberstation that referenced this pull request Jun 15, 2025
## 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.
github-merge-queue bot pushed a commit to Aurorastation/Aurora.3 that referenced this pull request Jun 19, 2025
## 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.
@wixoaGit
Copy link
Member

I think it would be better to emit the warning on their definition rather than their use.

Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link

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

Merge into pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler Involves the OpenDream compiler size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

args keyword takes priority over locally defined var/args usr is a soft reserved keyword
2 participants