Skip to content

Conversation

hamishknight
Copy link
Contributor

Pattern resolution currently invokes type resolution with this flag since it's trying to see if it can treat a given expression as a TypeRepr for e.g an enum pattern. Make sure we don't setInvalid on such TypeRepr nodes since that will avoid diagnosing in cases where the node also then gets treated as a TypeRepr for an ExprPattern, where we actually want the diagnostic emitted.

Also ensure that IgnoreInvalidASTNode emits a fallback diagnostic if no other error has been emitted to ensure that any future similar cases don't end up crashing the compiler in the ASTVerifier or SILGen.

Pattern resolution currently invokes type resolution with this flag
since it's trying to see if it can treat a given expression as a
TypeRepr for e.g an enum pattern. Make sure we don't `setInvalid` on
such TypeRepr nodes since that will avoid diagnosing in cases where
the node also then gets treated as a TypeRepr for an ExprPattern,
where we actually want the diagnostic emitted.
If no other error has been emitted, make sure we emit a fallback
diagnostic rather than crashing in the ASTVerifier or SILGen.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight enabled auto-merge August 28, 2025 17:05
@hamishknight hamishknight merged commit 2f5cfad into swiftlang:main Aug 29, 2025
5 checks passed
@hamishknight hamishknight deleted the reprap branch August 29, 2025 08:56
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.

3 participants