Files
swift-mirror/test/stmt/errors_nonobjc.swift
Joe Groff d998692b60 Sema/SIL: NSError has no special powers without ObjC interop.
In particular, it doesn't "toll-free bridge" to the Error existential on non-ObjC-interop platforms, and we would miscompile as if it could. This should fix SR-585.
2017-02-25 09:20:24 -08:00

20 lines
544 B
Swift

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %target-swift-frontend -emit-module -module-name Foundation -o %t/Foundation.swiftmodule %S/Inputs/Foundation-with-NSError.swift
// RUN: %target-swift-frontend -I %t -typecheck -verify %s
// UNSUPPORTED: objc_interop
import Foundation
// Catching `as NSError` ought *not* to be exhaustive when ObjC interop is
// disabled. It's just another error type.
func bar() throws {}
func foo() {
do {
try bar() // expected-error{{enclosing catch is not exhaustive}}
} catch _ as NSError {
}
}