Skip to content

Allow astype() to infer a type from its first argument#2522

Merged
wixoaGit merged 1 commit intoOpenDreamProject:masterfrom
wixoaGit:fix_implicit_astype
Feb 28, 2026
Merged

Allow astype() to infer a type from its first argument#2522
wixoaGit merged 1 commit intoOpenDreamProject:masterfrom
wixoaGit:fix_implicit_astype

Conversation

@wixoaGit
Copy link
Member

From the DM ref:

  1. If astype() is on the right-hand side of an assignment operation, the left-hand side's var type is the implied type, just like with the new() operator.
  2. Otherwise, the var type of the first argument is the implied type, just as it is in istype().

The behavior of 2 is now implemented.

Fixes #2521

@boring-cyborg boring-cyborg bot added the Compiler Involves the OpenDream compiler label Feb 27, 2026
@wixoaGit wixoaGit merged commit d9faa81 into OpenDreamProject:master Feb 28, 2026
19 checks passed
@wixoaGit wixoaGit deleted the fix_implicit_astype branch February 28, 2026 00:25
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/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

astype() within an if statement errors with OD2800, OD0011, OD4804

1 participant