File tree Expand file tree Collapse file tree 6 files changed +49
-4
lines changed Expand file tree Collapse file tree 6 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ internal let _errorDomainUserInfoProviderQueue = DispatchQueue(
202
202
203
203
/// Retrieve the default userInfo dictionary for a given error.
204
204
@_silgen_name ( " swift_Foundation_getErrorDefaultUserInfo " )
205
- public func _swift_Foundation_getErrorDefaultUserInfo( _ error: Error )
205
+ public func _swift_Foundation_getErrorDefaultUserInfo< T : Error > ( _ error: T )
206
206
-> AnyObject ? {
207
207
let hasUserInfoValueProvider : Bool
208
208
Original file line number Diff line number Diff line change 11
11
//===----------------------------------------------------------------------===//
12
12
import SwiftShims
13
13
14
- // TODO: API review
15
14
/// A type representing an error value that can be thrown.
16
15
///
17
16
/// Any type that declares conformance to the `Error` protocol can be used to
@@ -167,7 +166,7 @@ public func _stdlib_getErrorEmbeddedNSError<T : Error>(_ x: T)
167
166
}
168
167
169
168
@_silgen_name ( " swift_stdlib_getErrorDefaultUserInfo " )
170
- public func _stdlib_getErrorDefaultUserInfo( _ error: Error ) -> AnyObject ?
169
+ public func _stdlib_getErrorDefaultUserInfo< T : Error > ( _ error: T ) -> AnyObject ?
171
170
172
171
// Known function for the compiler to use to coerce `Error` instances
173
172
// to `NSError`.
Original file line number Diff line number Diff line change @@ -397,7 +397,7 @@ static Class getSwiftNativeNSErrorClass() {
397
397
const WitnessTable *Error);
398
398
399
399
// @_silgen_name("swift_stdlib_getErrorDefaultUserInfo")
400
- // public func _stdlib_getErrorDefaultUserInfo<T : Error>(_ x: UnsafePointer<T> ) -> AnyObject
400
+ // public func _stdlib_getErrorDefaultUserInfo<T : Error>(_ x: T ) -> AnyObject
401
401
SWIFT_CC (swift) SWIFT_RT_ENTRY_VISIBILITY
402
402
NSDictionary *swift_stdlib_getErrorDefaultUserInfo(
403
403
OpaqueValue *error,
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t
2
+ // RUN: mkdir -p %t
3
+ // RUN: %target-clang -fmodules -c -o %t/ErrorBridgedStaticImpl.o %S/Inputs/ErrorBridgedStaticImpl.m
4
+ // RUN: %target-build-swift -static-stdlib -o %t/ErrorBridgedStatic %t/ErrorBridgedStaticImpl.o %s -import-objc-header %S/Inputs/ErrorBridgedStaticImpl.h
5
+ // RUN: strip %t/ErrorBridgedStatic
6
+ // RUN: %t/ErrorBridgedStatic
7
+
8
+ // REQUIRES: executable_test
9
+ // REQUIRES: objc_interop
10
+ // REQUIRES: static_stdlib
11
+
12
+ import StdlibUnittest
13
+
14
+ class Bar : Foo {
15
+ override func foo( _ x: Int32 ) throws {
16
+ try super. foo ( 5 )
17
+ }
18
+ }
19
+
20
+ var ErrorBridgingStaticTests = TestSuite ( " ErrorBridging with static libs " )
21
+
22
+ ErrorBridgingStaticTests . test ( " round-trip Swift override of ObjC method " ) {
23
+ do {
24
+ try ( Bar ( ) as Foo ) . foo ( 5 )
25
+ } catch { }
26
+ }
27
+
28
+ runAllTests ( )
Original file line number Diff line number Diff line change
1
+ @import Foundation;
2
+
3
+ @interface Foo : NSObject
4
+
5
+ - (BOOL )foo : (int )x error : (NSError **)error ;
6
+
7
+ @end
Original file line number Diff line number Diff line change
1
+ #include " ErrorBridgedStaticImpl.h"
2
+
3
+ @implementation Foo
4
+
5
+ - (BOOL )foo : (int )x error : (NSError **)error {
6
+ *error = nil ;
7
+ return NO ;
8
+ }
9
+
10
+ @end
11
+
You can’t perform that action at this time.
0 commit comments