Skip to content

Commit 188ccab

Browse files
committed
[IDE] Remove special handling for multi-statement closures
1 parent ff3b938 commit 188ccab

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

lib/Sema/TypeCheckCodeCompletion.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -631,23 +631,6 @@ bool TypeChecker::typeCheckForCodeCompletion(
631631
if (solutions.empty())
632632
return CompletionResult::Fallback;
633633

634-
// If code completion expression resides inside of multi-statement
635-
// closure body it could either be type-checked together with the context
636-
// or not, it's impossible to say without checking.
637-
if (contextAnalyzer.locatedInMultiStmtClosure()) {
638-
if (!hasTypeForCompletion(solutions.front(), contextAnalyzer)) {
639-
// At this point we know the code completion node wasn't checked with
640-
// the closure's surrounding context, so can defer to regular
641-
// type-checking for the current call to typeCheckExpression. If that
642-
// succeeds we will get a second call to typeCheckExpression for the
643-
// body of the closure later and can gather completions then. If it
644-
// doesn't we rely on the fallback typechecking in the subclasses of
645-
// TypeCheckCompletionCallback that considers in isolation a
646-
// sub-expression of the closure that contains the completion location.
647-
return CompletionResult::NotApplicable;
648-
}
649-
}
650-
651634
// FIXME: instead of filtering, expose the score and viability to clients.
652635
// Remove solutions that skipped over/ignored the code completion point
653636
// or that require fixes and have a score that is worse than the best.

test/IDE/complete_call_arg.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ func curry<T1, T2, R>(_ f: @escaping (T1, T2) -> R) -> (T1) -> (T2) -> R {
469469
// NESTED_CLOSURE: Begin completions
470470
// FIXME: Should be '/TypeRelation[Invalid]: t2[#T2#]'
471471
// NESTED_CLOSURE: Decl[LocalVar]/Local: t2; name=t2
472-
// NESTED_CLOSURE: Decl[LocalVar]/Local: t1[#T1#]; name=t1
472+
// NESTED_CLOSURE: Decl[LocalVar]/Local: t1; name=t1
473473
}
474474

475475
func trailingClosureLocal(x: Int, fn: (Int) -> Void) {

0 commit comments

Comments
 (0)