Skip to content

Commit 5b7712c

Browse files
committed
[TypeChecker] Don’t crash if a ExplicitCastExpr doesn’t have a cast type
rdar://95629905 discovered an issue where we are crashing because an `ExplicitCastExpr` doesn’t have a cast type. It looks like this only occurs if we perform `performSyntacticDiagnosticsForTarget` from inside `applyResultBuilderBodyTransform`. rdar://95629905
1 parent ff129c3 commit 5b7712c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3229,7 +3229,7 @@ class ExprAvailabilityWalker : public ASTWalker {
32293229
maybeDiagParameterizedExistentialErasure(EE, Where);
32303230
}
32313231
if (auto *CC = dyn_cast<ExplicitCastExpr>(E)) {
3232-
if (!isa<CoerceExpr>(CC) &&
3232+
if (!isa<CoerceExpr>(CC) && CC->getCastType() &&
32333233
CC->getCastType()->hasParameterizedExistential()) {
32343234
SourceLoc loc = CC->getCastTypeRepr() ? CC->getCastTypeRepr()->getLoc()
32353235
: E->getLoc();

0 commit comments

Comments
 (0)