Skip to content

Conversation

@ringabout
Copy link
Member

@ringabout ringabout commented Oct 15, 2025

fixes #25123; fixes #11862

follow up #24442
ref #24441

To fix this, fields from inactive branches are now detected in semmacrosanity.annotateType (called in fixupTypeAfterEval) and marked to prevent the codegen of their assignments. In #24441 these fields were excluded from the resulting node, but this causes issues when the node is directly supposed to go back into the VM, for example as const values. I don't know if this is the only case where this happens, so I wasn't sure about how to keep that implementation working.

Object variants fields coming from inactive branches from VM are now flagged nfPreventCg. We can ignore them, as done by the C backends.

@ringabout ringabout changed the title fixes #25123; fixes #11862; Case object from compileTime proc unable … fixes #25123; fixes #11862; Case object from compileTime proc unable to be passed as static param Oct 15, 2025
@Araq Araq merged commit 5abd21d into devel Oct 16, 2025
28 of 29 checks passed
@Araq Araq deleted the pr_verlassen branch October 16, 2025 16:22
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 5abd21d

Hint: mm: orc; opt: speed; options: -d:release
183175 lines; 8.881s; 661.699MiB peakmem

narimiran pushed a commit that referenced this pull request Oct 17, 2025
…to be passed as static param (#25224)

fixes #25123; fixes #11862

follow up #24442
ref #24441

> To fix this, fields from inactive branches are now detected in
semmacrosanity.annotateType (called in fixupTypeAfterEval) and marked to
prevent the codegen of their assignments. In
#24441 these fields were excluded
from the resulting node, but this causes issues when the node is
directly supposed to go back into the VM, for example as const values. I
don't know if this is the only case where this happens, so I wasn't sure
about how to keep that implementation working.

Object variants fields coming from inactive branches from VM are now
flagged `nfPreventCg`. We can ignore them, as done by the C backends.

(cherry picked from commit 5abd21d)
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.

Case object from compileTime proc unable to be passed as static param False positive detection of conflicting branches of object variant

3 participants