Skip to content

Commit 5e4390c

Browse files
committed
Update ConstraintSystem::dump to check hasType before calling getType.
We assert if the type isn't in the cache, so we need to check that before attempting to fetch the type, and return Type() if we do not have it in the cache.
1 parent 683542d commit 5e4390c

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
@@ -3125,9 +3125,15 @@ void ConstraintSystem::dump() {
31253125
}
31263126

31273127
void ConstraintSystem::dump(Expr *E) {
3128-
auto getTypeOfExpr = [&](const Expr *E) -> Type { return getType(E); };
3128+
auto getTypeOfExpr = [&](const Expr *E) -> Type {
3129+
if (hasType(E))
3130+
return getType(E);
3131+
return Type();
3132+
};
31293133
auto getTypeOfTypeLoc = [&](const TypeLoc &TL) -> Type {
3130-
return getType(TL);
3134+
if (hasType(TL))
3135+
return getType(TL);
3136+
return Type();
31313137
};
31323138

31333139
E->dump(getTypeOfExpr, getTypeOfTypeLoc);

0 commit comments

Comments
 (0)