Skip to content

Commit

Permalink
Merge pull request #5751 from jtbandes/validation-ignore-unchecked
Browse files Browse the repository at this point in the history
[Sema] Skip UNCHECKED_EXPRs in ErrorHandlingWalker
  • Loading branch information
slavapestov committed Nov 14, 2016
2 parents c6e3846 + dfea7ee commit 783012f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/Sema/TypeCheckError.cpp
Expand Up @@ -210,6 +210,13 @@ class ErrorHandlingWalker : public ASTWalker {
} else if (auto apply = dyn_cast<ApplyExpr>(E)) {
recurse = asImpl().checkApply(apply);
}
// Error handling validation (via checkTopLevelErrorHandling) happens after
// type checking. If an unchecked expression is still around, the code was
// invalid.
#define UNCHECKED_EXPR(KIND, BASE) \
else if (isa<KIND##Expr>(E)) return {false, nullptr};
#include "swift/AST/ExprNodes.def"

return {bool(recurse), E};
}

Expand Down
Expand Up @@ -5,6 +5,6 @@
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

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

0 comments on commit 783012f

Please sign in to comment.