bugfix(semantic): Removed extra diagnostic for type mismatches on missing. - #10121
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryLow Risk Overview In A Reviewed by Cursor Bugbot for commit dc8e6c9. Bugbot is set up for automated code reviews on this repo. Configure here. |
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on eytan-starkware).

Summary
When an impl constant references an unresolvable type (e.g.,
const X: Nonexistent = 0;), the compiler was previously emitting both a "Type not found" error and a spurious "WrongType" mismatch diagnostic. The type mismatch check invalidate_impl_item_constantnow skips reporting when either the expected or actual type is a missing (error sentinel) type, suppressing the cascading false diagnostic.Type of change
Please check one:
Why is this change needed?
When a type in an impl constant declaration could not be resolved, the compiler would report the legitimate "Type not found" error and then also emit a spurious "WrongType" diagnostic, because the missing type sentinel did not match the expected concrete type. This caused confusing double-error output for a single root cause.
What was the behavior or documentation before?
Given:
The compiler emitted both a "Type not found" error for
Nonexistentand a secondary "WrongType" mismatch error.What is the behavior or documentation after?
The compiler now emits only the "Type not found" error, suppressing the cascading type-mismatch diagnostic when either type involved in the comparison is a missing/error sentinel type.
Related issue or discussion (if any)
N/A
Additional context
A new test case was added to
trait_constto assert that only the resolution error is reported and no spurious type-mismatch diagnostic appears.