Skip to content

Compiler: a constant converts to its type even when that type was just rebuilt - #2588

Merged
bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/attribute-default-of-a-rebuilt-type
Oct 27, 2026
Merged

bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/attribute-default-of-a-rebuilt-type

Conversation

@jayrulez

Copy link
Copy Markdown
Contributor

Reifying a module rebuilds its types in place, back to undefined until they are populated again. A method declared in that window can resolve an attribute whose constructor has a default of such a type (an enum): GetTypedValueFromConstant asked the undefined enum whether it was a typed primitive, got no, failed the explicit cast silently, and the attribute was dropped from the method with no error.

No test here: the window needs a type first made by comptime reflection before the compile's typedef loop reaches it, which hash order decides.

…t rebuilt

Reifying a module rebuilds its types in place, back to undefined until
they are populated again. A method declared in that window can resolve
an attribute whose constructor has a default of such a type (an enum):
GetTypedValueFromConstant asked the undefined enum whether it was a
typed primitive, got no, failed the explicit cast silently, and the
attribute was dropped from the method with no error.

Seen in Sedulous's GUI: [GuiProperty]'s `GuiPropertyFlags flags = .None`
default, and every Node property lost its attribute, depending on the
order its types were first reached. GetTypedValueFromConstant now
populates an incomplete type before converting to it.

No test here: the window needs a type first made by comptime reflection
before the compile's typedef loop reaches it, which hash order decides.
@bfiete
bfiete merged commit 22e25d0 into beefytech:master Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants