Skip to content

Commit 3084d09

Browse files
committed
Ignore missing types on for statement expressions
A malformed initializer or increment expression would come out of TypeChecker::typeCheckExpression() with no type, which `checkIgnoredExpr()` was not expecting. Fixes: * test/Parse/foreach.swift * test/Parse/recovery.swift * test/Parse/toplevel_library_invalid.swift * test/IDE/complete_stmt_controlling_expr.swift * validation-test/compiler_crashers_fixed/01736-void.swift * validation-test/compiler_crashers_fixed/00587-swift-pattern-foreachvariable.swift
1 parent a3bda75 commit 3084d09

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,12 @@ void TypeChecker::checkIgnoredExpr(Expr *E) {
10691069
}
10701070
return;
10711071
}
1072+
1073+
// Skip checking if there is no type, which presumably means there was a
1074+
// type error.
1075+
if (!E->getType()) {
1076+
return;
1077+
}
10721078

10731079
// Complain about l-values that are neither loaded nor stored.
10741080
if (E->getType()->isLValueType()) {

0 commit comments

Comments
 (0)