Skip to content

Commit 783012f

Browse files
authored
Merge pull request #5751 from jtbandes/validation-ignore-unchecked
[Sema] Skip UNCHECKED_EXPRs in ErrorHandlingWalker
2 parents c6e3846 + dfea7ee commit 783012f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/Sema/TypeCheckError.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ class ErrorHandlingWalker : public ASTWalker {
210210
} else if (auto apply = dyn_cast<ApplyExpr>(E)) {
211211
recurse = asImpl().checkApply(apply);
212212
}
213+
// Error handling validation (via checkTopLevelErrorHandling) happens after
214+
// type checking. If an unchecked expression is still around, the code was
215+
// invalid.
216+
#define UNCHECKED_EXPR(KIND, BASE) \
217+
else if (isa<KIND##Expr>(E)) return {false, nullptr};
218+
#include "swift/AST/ExprNodes.def"
219+
213220
return {bool(recurse), E};
214221
}
215222

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// See http://swift.org/LICENSE.txt for license information
66
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -emit-ir
8+
// RUN: not %target-swift-frontend %s -emit-ir
99
// REQUIRES: asserts
1010
assert||()->s

0 commit comments

Comments
 (0)