mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
15 lines
295 B
Swift
15 lines
295 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
// Catching `as NSError` ought to be exhaustive when ObjC interop is enabled.
|
|
func bar() throws {}
|
|
|
|
func foo() {
|
|
do {
|
|
try bar()
|
|
} catch _ as NSError {
|
|
}
|
|
}
|