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

[TypeChecker] Avoid dropping pre-check diagnostics in `typeCheckParam… #80280

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Mar 25, 2025

…eterDefault`

typeCheck{Expression, Target} has a pre-check phase which would replace some invalid AST nodes (i.e. name references that are not available in the given declaration context) with ErrorExprs and emit a diagnostic. Such diagnostics were then dropped by abort() call to a diagnostic transaction. This results in invalid code being accepted by Sema and forwarded to SILGen.

Resolves: #73986
Resolves: rdar://131732245

@xedin xedin requested a review from hamishknight March 25, 2025 18:02
@slavapestov
Copy link
Contributor

We shouldn’t be using diagnostic transactions at all. The whole concept is fundamentally incompatible with the request evaluator.

@xedin
Copy link
Contributor Author

xedin commented Mar 25, 2025

I don't think anybody disagrees with that :)

@xedin
Copy link
Contributor Author

xedin commented Mar 25, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Mar 25, 2025

We should fold this into the constraint solver itself, that would eliminate the need for diagnostic transactions in this particular case.

…eterDefault`

`typeCheck{Expression, Target}` has a pre-check phase which would
replace some invalid AST nodes (i.e. name references that are not
available in the given declaration context) with `ErrorExpr`s and
emit a diagnostic. Such diagnostics were then dropped by `abort()`
call to a diagnostic transaction. This results in invalid code being
accepted by Sema and forwarded to SILGen.

Resolves: swiftlang#73986
Resolves: rdar://131732245
@xedin
Copy link
Contributor Author

xedin commented Mar 26, 2025

@swift-ci please smoke test

@xedin xedin merged commit 6082173 into swiftlang:main Mar 27, 2025
3 checks passed
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.

Type Lookup Crashes when Declaring Initializer (default generic closure argument, nonexistent type)
4 participants