-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix(sem): crash with erroneous is
expression
#1485
Merged
zerbina
merged 4 commits into
nim-works:devel
from
zerbina:sem-fix-when-error-propagation
Jan 11, 2025
Merged
fix(sem): crash with erroneous is
expression
#1485
zerbina
merged 4 commits into
nim-works:devel
from
zerbina:sem-fix-when-error-propagation
Jan 11, 2025
+30
−21
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace `semConstExpr` with `semRealConstExpr`, the latter which returns `nkError` nodes. `semRealConstExpr` was also missing the execution context handling that `semConstExpr` uses.
zerbina
added
bug
Something isn't working
compiler/sem
Related to semantic-analysis system of the compiler
labels
Jan 6, 2025
saem
approved these changes
Jan 6, 2025
/merge |
Merge requested by: @saem Contents after the first section break of the PR description has been removed and preserved below: |
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 6, 2025
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 9, 2025
/merge |
Loading status checks…
I merged |
CI is still stuck, it seems. I'll try a reopen. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fix a crash with erroneous
is
expressions appearing directly as awhen
conditions expressions causing the compiler to crash.Details
There were two issues:
semIs
modified input AST, which led to the error correction in thefitNode
called byforceBool
called bysemWhen
not triggeringsemWhen
used thesemConstExpr
, which doesn't return annkError
on failure, thus leading to a field access defect when happening in
a context where
localReport
doesn't terminate the compilersemIs
is changed to not modify input AST. In addition, the workaroundfor
is
being analyzed eagerly in generic expression is removed, asit's no longer needed.
In
semWhen
, the usage ofsemConstExpr
is replaced withsemRealConstExpr
, which properly propagatesnkError
. The latter wasmissing execution context handling (needed for detecting illegal
break
s crossing the compile-time / run-time boundary), which is nowfixed too.
Fixes #1483.