Skip to content

Commit 48b491d

Browse files
committed
AST: Avoid invoking TypeAliasDecl::getUnderlyingType() from isInterestingTypealias()
Diagnostics are emitted from weird places sometimes, and as a result the emission is fragile for two reasons: - Kicking off requests can trigger cycles - Doing anything that can re-entrantly diagnose something else might crash In this case, the problem is getUnderlyingType(), which might kick off type resolution on the typealias. Since we already have a Type, just check that instead of getting a new one.
1 parent 0045840 commit 48b491d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/AST/DiagnosticEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static bool isInterestingTypealias(Type type) {
480480
else
481481
return false;
482482

483-
if (aliasDecl->getUnderlyingType()->isVoid())
483+
if (type->isVoid())
484484
return false;
485485

486486
// The 'Swift.AnyObject' typealias is not 'interesting'.

0 commit comments

Comments
 (0)