File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
validation-test/IDE/stress_tester_issues_fixed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -1993,11 +1993,16 @@ bool TypeVariableBinding::attempt(ConstraintSystem &cs) const {
19931993 // without any contextual information, so even though `x` would get
19941994 // bound to result type of the chain, underlying type variable wouldn't
19951995 // be resolved, so we need to propagate holes up the conversion chain.
1996- if (TypeVar->getImpl ().canBindToHole () &&
1997- srcLocator->directlyAt <OptionalEvaluationExpr>()) {
1998- if (auto objectTy = type->getOptionalObjectType ()) {
1999- if (auto *typeVar = objectTy->getAs <TypeVariableType>())
2000- cs.recordPotentialHole (typeVar);
1996+ // Also propagate in code completion mode because in some cases code
1997+ // completion relies on type variable being a potential hole.
1998+ if (TypeVar->getImpl ().canBindToHole ()) {
1999+ if (srcLocator->directlyAt <OptionalEvaluationExpr>() ||
2000+ cs.isForCodeCompletion ()) {
2001+ if (auto objectTy = type->getOptionalObjectType ()) {
2002+ if (auto *typeVar = objectTy->getAs <TypeVariableType>()) {
2003+ cs.recordPotentialHole (typeVar);
2004+ }
2005+ }
20012006 }
20022007 }
20032008
Original file line number Diff line number Diff line change 1+ // RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token COMPLETE | %FileCheck %s
2+
3+ struct Foo {
4+ var x : Int = {
5+ guard let foo = #^COMPLETE^#
6+ } ( )
7+ }
8+
9+ // CHECK: Decl[Struct]/CurrModule: Foo[#Foo#];
You can’t perform that action at this time.
0 commit comments