Skip to content

[Sema] Avoid folding sequences multiple times #83034

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

Merged
merged 2 commits into from
Jul 15, 2025

Conversation

hamishknight
Copy link
Contributor

Completion can end up calling into pre-checking multiple times in certain cases, make sure we don't attempt to fold a SequenceExpr multiple times since its original AST is in a broken state post-folding. Instead, just return the already-folded expression.

rdar://133717866
Resolves #75845

Completion can end up calling into pre-checking multiple times in
certain cases, make sure we don't attempt to fold a SequenceExpr
multiple times since its original AST is in a broken state
post-folding. Instead, just return the already-folded expression.

rdar://133717866
Turns out we can also hit this case for some pattern type-checking
cases. I'll fix those in a follow-up and reinstate the assertion.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@@ -1,3 +1,3 @@
// {"signature":"makeBinOp(swift::ASTContext&, swift::Expr*, swift::Expr*, swift::Expr*, swift::PrecedenceGroupDecl*, bool)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
// RUN: not %target-swift-frontend -typecheck %s
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this also affects pattern type-checking, I'll look into that in a follow-up

@hamishknight hamishknight changed the title [Sema] Avoid folding sequences multiple times for completion [Sema] Avoid folding sequences multiple times Jul 14, 2025
@hamishknight hamishknight merged commit 818979f into swiftlang:main Jul 15, 2025
5 checks passed
@hamishknight hamishknight deleted the origami branch July 15, 2025 08:14
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.

Assertion failed: (hasType(node) && "Expected type to have been set!") when assigning self from implicit error variable
2 participants