forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make @objc enums that conform to ErrorType also conform to _Objective…
…CBridgeableErrorType. This allows @objc enum error types produced in Objective-C (e.g., via +[NSError errorWithDomain:code:userInfo:]) to be bridged back to their original enum types in Swift via pattern matching/catch blocks. This finishes rdar://problem/20577517. Swift SVN r28803
- Loading branch information
1 parent
db53a22
commit 7405064
Showing
11 changed files
with
179 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: %target-parse-verify-swift | ||
|
||
import Foundation | ||
|
||
func acceptBridgeableNSError<E : _ObjectiveCBridgeableErrorType>(e: E) { } | ||
|
||
@objc enum E1 : Int, ErrorType, _BridgedNSError { | ||
case A = 1 | ||
} | ||
|
||
acceptBridgeableNSError(E1.A) | ||
|
||
@objc enum E2 : Int, ErrorType { | ||
case A = 1 | ||
} | ||
|
||
acceptBridgeableNSError(E2.A) | ||
|
||
|
||
@objc enum E3 : Int { | ||
case A = 1 | ||
} | ||
|
||
acceptBridgeableNSError(E3.A) | ||
// expected-error@-1{{cannot invoke 'acceptBridgeableNSError' with an argument list of type '(E3)'}} | ||
// expected-note@-2{{expected an argument list of type '(E)'}} |