Skip to content

Commit 95f1b07

Browse files
committed
[Sema] Remove completion assert in foldSequence for now
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.
1 parent af96c98 commit 95f1b07

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/Sema/TypeCheckExpr.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ swift::DefaultTypeRequest::evaluate(Evaluator &evaluator,
613613
}
614614

615615
Expr *TypeChecker::foldSequence(SequenceExpr *expr, DeclContext *dc) {
616-
// We may end up running pre-checking multiple times for completion, just use
617-
// the folded expression if we've already folded the sequence.
618-
// FIXME: We ought to fix completion to not pre-check multiple times, strictly
619-
// speaking it isn't idempotent (e.g for things like `markDirectCallee`).
620-
if (auto *folded = expr->getFoldedExpr()) {
621-
ASSERT(dc->getASTContext().CompletionCallback &&
622-
"Attempting to fold sequence twice?");
616+
// We may end up running pre-checking multiple times for completion and
617+
// pattern type-checking, just use the folded expression if we've already
618+
// folded the sequence.
619+
// FIXME: We ought to fix these cases to not pre-check multiple times,
620+
// strictly speaking it isn't idempotent (e.g for things like
621+
// `markDirectCallee`).
622+
if (auto *folded = expr->getFoldedExpr())
623623
return folded;
624-
}
624+
625625
// First resolve any unresolved decl references in operator positions.
626626
for (auto i : indices(expr->getElements())) {
627627
if (i % 2 == 0)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"signature":"makeBinOp(swift::ASTContext&, swift::Expr*, swift::Expr*, swift::Expr*, swift::PrecedenceGroupDecl*, bool)"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
let a= switch a { case &b as? b

0 commit comments

Comments
 (0)