fix: reject non-concrete eq/ne/not in const evaluation#9877
Open
s0mnathh wants to merge 1 commit into
Open
Conversation
orizi
requested changes
Apr 28, 2026
orizi
left a comment
Collaborator
There was a problem hiding this comment.
@orizi reviewed all commit messages and made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on s0mnathh).
a discussion (no related file):
fixed by #9879
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Reject non-concrete equality, inequality, and logical-not operations during constant evaluation. Add a regression test for
!F::FLAGon generic impl constants and report E2127 instead of folding the expression.Type of change
Please check one:
Why is this change needed?
Generic impl constants are not fully concrete during constant evaluation, so
==,!=, and!should not be folded eagerly. Before this change these operators could bypass the existing non-concrete checks and produce an incorrect boolean result instead of a diagnostic.What was the behavior or documentation before?
Constant evaluation could accept equality, inequality, or logical-not expressions over generic impl constants and fold them as if the value were known. This could silently produce the wrong constant result instead of reporting E2127.
What is the behavior or documentation after?
The evaluator now reports E2127 for
==,!=, and!when any argument is a non-concrete impl constant. The regression test covers!F::FLAGand verifies that unsupported constant expressions are rejected.Related issue or discussion (if any)
Additional context
This follows the same constant-evaluation policy already used for other unsupported operations on generic impl constants and keeps the fix scoped to the boolean operator fast path.