Skip to content

Commit e1a9be5

Browse files
authored
Merge pull request #39410 from ahoppen/pr/node-has-no-type-in-solution
[CodeComplete] Don't crash if solution doesn't contain a type for the parsed expression
2 parents 579e37d + 2508e6c commit e1a9be5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/TypeCheckCodeCompletion.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,11 @@ fallbackTypeCheck(DeclContext *DC) {
10571057
}
10581058

10591059
static Type getTypeForCompletion(const constraints::Solution &S, Expr *E) {
1060+
if (!S.hasType(E)) {
1061+
assert(false && "Expression wasn't type checked?");
1062+
return nullptr;
1063+
}
1064+
10601065
auto &CS = S.getConstraintSystem();
10611066

10621067
// To aid code completion, we need to attempt to convert type placeholders

0 commit comments

Comments
 (0)