Skip to content

Commit 587fde5

Browse files
committed
In -debug-constraints, only attempt to print types that we've cached.
Calling getType() when the type is not in the cache results in an assert.
1 parent 0ae61f6 commit 587fde5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,9 +1380,15 @@ ConstraintSystem::solve(Expr *&expr,
13801380
}
13811381

13821382
if (TC.getLangOpts().DebugConstraintSolver) {
1383-
auto getTypeOfExpr = [&](const Expr *E) -> Type { return getType(E); };
1383+
auto getTypeOfExpr = [&](const Expr *E) -> Type {
1384+
if (hasType(E))
1385+
return getType(E);
1386+
return Type();
1387+
};
13841388
auto getTypeOfTypeLoc = [&](const TypeLoc &TL) -> Type {
1385-
return getType(TL);
1389+
if (hasType(TL))
1390+
return getType(TL);
1391+
return Type();
13861392
};
13871393

13881394
auto &log = getASTContext().TypeCheckerDebug->getStream();

0 commit comments

Comments
 (0)