Skip to content

Commit bd0aff4

Browse files
committed
[CodeComplete] Query the Solution for contextual type
Instead of querying the ConstraintSystem, query the Solution instead, as the ConstraintSystem is not necessarily in the same state as when the solution was produced.
1 parent cc72301 commit bd0aff4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/IDE/TypeCheckCompletionCallback.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ Type swift::ide::getTypeForCompletion(const constraints::Solution &S,
5252
return nullptr;
5353
}
5454

55-
auto &CS = S.getConstraintSystem();
56-
5755
Type Result;
5856

5957
if (isExpr<CodeCompletionExpr>(Node)) {
@@ -62,9 +60,9 @@ Type swift::ide::getTypeForCompletion(const constraints::Solution &S,
6260
Result = S.getResolvedType(Node);
6361
}
6462

65-
if (!Result || Result->is<UnresolvedType>()) {
66-
Result = CS.getContextualType(Node, /*forConstraint=*/false);
67-
}
63+
if (!Result || Result->is<UnresolvedType>())
64+
Result = S.getContextualType(Node);
65+
6866
if (Result && Result->is<UnresolvedType>()) {
6967
Result = Type();
7068
}

0 commit comments

Comments
 (0)