Skip to content
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

generate tyFromExpr for when in generics #24066

Merged
merged 2 commits into from
Sep 6, 2024
Merged

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Sep 5, 2024

fixes #22342, fixes #22607

Another followup of #22029, when expressions in general in generic type bodies now behave like nkRecWhen does since #24042, leaving them as tyFromExpr if a condition is uncertain. The tests for the issues were originally added but left disabled in #24005.

@Araq Araq merged commit 7cd1777 into nim-lang:devel Sep 6, 2024
19 checks passed
Copy link
Contributor

github-actions bot commented Sep 6, 2024

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

Hint: mm: orc; opt: speed; options: -d:release
174157 lines; 8.918s; 655.23MiB peakmem

metagn added a commit to metagn/Nim that referenced this pull request Sep 6, 2024
Araq pushed a commit that referenced this pull request Sep 8, 2024
fixes CI, refs #24066, refs #24065

The combination of #24065 and #24066 caused a CI failure where a `when`
branch that was never compiled gave an undeclared identifier error. This
is because the `when` branch was being semchecked with `semGenericStmt`
without `withinMixin`, which is the flag `semgnrc` normally gives to
`when` branch bodies. To fix this, just pass the whole `when` stmt to
`semGenericStmt` rather than the individual blocks.

The alternative would be to just replace the calls to `semGenericStmt`
with a new proc that does the same thing, just with the flags
`{withinMixin}`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants