Skip to content

Commit 839e20b

Browse files
committed
[Completion] Assert we have a type in getClosureActorIsolation
Previously we could end up in cases where we pick the wrong DeclContext in `TypeCheckASTNodeAtLocRequest` since we previously weren't checking source ranges, which could result in skipping the type-checking of an outer closure. Now that we correctly pick the DeclContext, we should no longer hit that case, so we should be able to fall into `getTypeForCompletion` and assert that the solution has a type. Also while here let's upgrade that assert to a `CONDITIONAL_ASSERT`.
1 parent 110f114 commit 839e20b

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

lib/IDE/PostfixCompletion.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ getClosureActorIsolation(const Solution &S, AbstractClosureExpr *ACE) {
110110
if (auto Ty = target->getClosureContextualType())
111111
return Ty;
112112
}
113-
if (!S.hasType(E)) {
114-
return Type();
115-
}
116113
return getTypeForCompletion(S, E);
117114
};
118115
auto getClosureActorIsolationThunk = [&S](AbstractClosureExpr *ACE) {

lib/IDE/TypeCheckCompletionCallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Type swift::ide::getTypeForCompletion(const constraints::Solution &S,
5858
}
5959

6060
if (!S.hasType(Node)) {
61-
assert(false && "Expression wasn't type checked?");
61+
CONDITIONAL_ASSERT(false && "Expression wasn't type checked?");
6262
return nullptr;
6363
}
6464

0 commit comments

Comments
 (0)