Skip to content

Commit 0ae61f6

Browse files
authored
Merge pull request #14774 from rudkx/cs-check-type-before-getting
Update ConstraintSystem::dump to check hasType before calling getType.
2 parents 786cfc5 + 5e4390c commit 0ae61f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,9 +3121,15 @@ void ConstraintSystem::dump() {
31213121
}
31223122

31233123
void ConstraintSystem::dump(Expr *E) {
3124-
auto getTypeOfExpr = [&](const Expr *E) -> Type { return getType(E); };
3124+
auto getTypeOfExpr = [&](const Expr *E) -> Type {
3125+
if (hasType(E))
3126+
return getType(E);
3127+
return Type();
3128+
};
31253129
auto getTypeOfTypeLoc = [&](const TypeLoc &TL) -> Type {
3126-
return getType(TL);
3130+
if (hasType(TL))
3131+
return getType(TL);
3132+
return Type();
31273133
};
31283134

31293135
E->dump(getTypeOfExpr, getTypeOfTypeLoc);

0 commit comments

Comments
 (0)