Skip to content

Commit f129c55

Browse files
committed
[IDE] Remove special handling for multi-statement closures
1 parent 258ed09 commit f129c55

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
@@ -633,23 +633,6 @@ bool TypeChecker::typeCheckForCodeCompletion(
633633
if (solutions.empty())
634634
return CompletionResult::Fallback;
635635

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