|
1 | 1 |
|
2 |
| -// Swift 3 sees the ObjC class NSRuncibleSpoon as the class, and uses methods |
| 2 | +// Swift 4 sees the ObjC class NSRuncibleSpoon as the class, and uses methods |
3 | 3 | // with type signatures involving NSRuncibleSpoon to conform to protocols
|
4 |
| -// across the language boundary. Swift 4 sees the type as bridged to |
| 4 | +// across the language boundary. Swift 5 sees the type as bridged to |
5 | 5 | // a RuncibleSpoon value type, but still needs to be able to use conformances
|
6 |
| -// declared by Swift 3. |
| 6 | +// declared by Swift 4. |
7 | 7 |
|
8 |
| -// Swift 3, importing Swift 3 and Swift 4 code |
| 8 | +// Swift 4, importing Swift 4 and Swift 5 code |
9 | 9 |
|
10 | 10 | import SomeObjCModule
|
11 |
| -import SomeSwift3Module |
12 | 11 | import SomeSwift4Module
|
| 12 | +import SomeSwift5Module |
13 | 13 |
|
14 | 14 | func testMatchAndMix(bridged: RuncibleSpoon, unbridged: NSRuncibleSpoon) {
|
15 | 15 | let objcInstanceViaClass
|
16 | 16 | = SomeObjCClass(someSwiftInitRequirement: unbridged)
|
17 | 17 |
|
18 |
| - let objcClassAsS3Protocol: SomeSwift3Protocol.Type = SomeObjCClass.self |
19 |
| - let objcInstanceViaS3Protocol |
20 |
| - = objcClassAsS3Protocol.init(someSwiftInitRequirement: unbridged) |
21 |
| - |
22 | 18 | let objcClassAsS4Protocol: SomeSwift4Protocol.Type = SomeObjCClass.self
|
23 | 19 | let objcInstanceViaS4Protocol
|
24 |
| - = objcClassAsS4Protocol.init(someSwiftInitRequirement: bridged) |
| 20 | + = objcClassAsS4Protocol.init(someSwiftInitRequirement: unbridged) |
| 21 | + |
| 22 | + let objcClassAsS5Protocol: SomeSwift5Protocol.Type = SomeObjCClass.self |
| 23 | + let objcInstanceViaS5Protocol |
| 24 | + = objcClassAsS5Protocol.init(someSwiftInitRequirement: bridged) |
25 | 25 |
|
26 | 26 | var bridgedSink: RuncibleSpoon
|
27 | 27 | var unbridgedSink: NSRuncibleSpoon
|
28 | 28 |
|
29 | 29 | let swiftPropertyViaClass = objcInstanceViaClass.someSwiftPropertyRequirement
|
30 | 30 | unbridgedSink = swiftPropertyViaClass
|
31 |
| - let swiftPropertyViaS3Protocol = objcInstanceViaS3Protocol.someSwiftPropertyRequirement |
32 |
| - unbridgedSink = swiftPropertyViaS3Protocol |
33 | 31 | let swiftPropertyViaS4Protocol = objcInstanceViaS4Protocol.someSwiftPropertyRequirement
|
34 |
| - bridgedSink = swiftPropertyViaS4Protocol |
| 32 | + unbridgedSink = swiftPropertyViaS4Protocol |
| 33 | + let swiftPropertyViaS5Protocol = objcInstanceViaS5Protocol.someSwiftPropertyRequirement |
| 34 | + bridgedSink = swiftPropertyViaS5Protocol |
35 | 35 |
|
36 | 36 | objcInstanceViaClass.someSwiftMethodRequirement(unbridged)
|
37 |
| - objcInstanceViaS3Protocol.someSwiftMethodRequirement(unbridged) |
38 |
| - objcInstanceViaS4Protocol.someSwiftMethodRequirement(bridged) |
39 |
| - |
40 |
| - let swift3InstanceViaClass |
41 |
| - = SomeSwift3Class(someObjCInitRequirement: unbridged) |
42 |
| - let swift3ClassAsProtocol: SomeObjCProtocol.Type = SomeSwift3Class.self |
43 |
| - let swift3InstanceViaProtocol |
44 |
| - = swift3ClassAsProtocol.init(someObjCInitRequirement: unbridged) |
45 |
| - |
46 |
| - let objcPropertyViaClassS3 = swift3InstanceViaClass.someObjCPropertyRequirement |
47 |
| - unbridgedSink = objcPropertyViaClassS3 |
48 |
| - let objcPropertyViaProtocolS3 = swift3InstanceViaProtocol.someObjCPropertyRequirement |
49 |
| - unbridgedSink = objcPropertyViaProtocolS3 |
50 |
| - |
51 |
| - swift3InstanceViaClass.someObjCMethodRequirement(unbridged) |
52 |
| - swift3InstanceViaProtocol.someObjCMethodRequirement(unbridged) |
| 37 | + objcInstanceViaS4Protocol.someSwiftMethodRequirement(unbridged) |
| 38 | + objcInstanceViaS5Protocol.someSwiftMethodRequirement(bridged) |
53 | 39 |
|
54 | 40 | let swift4InstanceViaClass
|
55 |
| - = SomeSwift4Class(someObjCInitRequirement: bridged) |
| 41 | + = SomeSwift4Class(someObjCInitRequirement: unbridged) |
56 | 42 | let swift4ClassAsProtocol: SomeObjCProtocol.Type = SomeSwift4Class.self
|
57 | 43 | let swift4InstanceViaProtocol
|
58 | 44 | = swift4ClassAsProtocol.init(someObjCInitRequirement: unbridged)
|
59 | 45 |
|
60 | 46 | let objcPropertyViaClassS4 = swift4InstanceViaClass.someObjCPropertyRequirement
|
61 |
| - bridgedSink = objcPropertyViaClassS4 |
| 47 | + unbridgedSink = objcPropertyViaClassS4 |
62 | 48 | let objcPropertyViaProtocolS4 = swift4InstanceViaProtocol.someObjCPropertyRequirement
|
63 | 49 | unbridgedSink = objcPropertyViaProtocolS4
|
64 | 50 |
|
65 |
| - swift4InstanceViaClass.someObjCMethodRequirement(bridged) |
| 51 | + swift4InstanceViaClass.someObjCMethodRequirement(unbridged) |
66 | 52 | swift4InstanceViaProtocol.someObjCMethodRequirement(unbridged)
|
67 | 53 |
|
| 54 | + let swift5InstanceViaClass |
| 55 | + = SomeSwift5Class(someObjCInitRequirement: bridged) |
| 56 | + let swift5ClassAsProtocol: SomeObjCProtocol.Type = SomeSwift5Class.self |
| 57 | + let swift5InstanceViaProtocol |
| 58 | + = swift5ClassAsProtocol.init(someObjCInitRequirement: unbridged) |
| 59 | + |
| 60 | + let objcPropertyViaClassS5 = swift5InstanceViaClass.someObjCPropertyRequirement |
| 61 | + bridgedSink = objcPropertyViaClassS5 |
| 62 | + let objcPropertyViaProtocolS5 = swift5InstanceViaProtocol.someObjCPropertyRequirement |
| 63 | + unbridgedSink = objcPropertyViaProtocolS5 |
| 64 | + |
| 65 | + swift5InstanceViaClass.someObjCMethodRequirement(bridged) |
| 66 | + swift5InstanceViaProtocol.someObjCMethodRequirement(unbridged) |
| 67 | + |
68 | 68 | _ = bridgedSink
|
69 | 69 | _ = unbridgedSink
|
70 | 70 | }
|
|
0 commit comments