Skip to content

Commit 4c87546

Browse files
committed
Reflection: More robust typeref_decoding_objc test
Go through some pains to ensure that we emit an override for the default initializer, since otherwise we emit a fatalError() call which ends up creating some closures. The exact order of the closures changed between master and swift-3.0-preview-1-branch. It is better not to test this part at all.
1 parent 2b1bfcb commit 4c87546

File tree

2 files changed

+16
-75
lines changed

2 files changed

+16
-75
lines changed

test/Reflection/Inputs/ObjectiveCTypes.swift

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,15 @@ import Foundation
22
import CoreGraphics
33

44
public class OC : NSObject {
5-
public let nsObject: NSObject
6-
public let nsString: NSString
7-
public let cfString: CFString
8-
public let aBlock: @convention(block) () -> ()
9-
public init(nsObject: NSObject, nsString: NSString, cfString: CFString,
10-
aBlock: @convention(block) () -> ()) {
11-
self.nsObject = nsObject
12-
self.nsString = nsString
13-
self.cfString = cfString
14-
self.aBlock = aBlock
15-
}
5+
public let nsObject: NSObject = NSObject()
6+
public let nsString: NSString = ""
7+
public let cfString: CFString = ""
8+
public let aBlock: @convention(block) () -> () = {}
9+
public let ocnss: GenericOC<NSString> = GenericOC()
10+
public let occfs: GenericOC<CFString> = GenericOC()
1611
}
1712

1813
public class GenericOC<T> : NSObject {
19-
public let ocnss: GenericOC<NSString>
20-
public let occfs: GenericOC<CFString>
21-
public init(nss: GenericOC<NSString>, cfs: GenericOC<CFString>) {
22-
self.ocnss = nss
23-
self.occfs = cfs
24-
}
2514
}
2615

2716
public class HasObjCClasses {

test/Reflection/typeref_decoding_objc.swift

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
// CHECK: (function convention=block
2121
// CHECK: (tuple))
2222

23-
// CHECK: TypesToReflect.GenericOC
24-
// CHECK: ------------------------
2523
// CHECK: ocnss: TypesToReflect.GenericOC<__ObjC.NSString>
2624
// CHECK: (bound_generic_class TypesToReflect.GenericOC
2725
// CHECK: (class __ObjC.NSString))
@@ -30,6 +28,9 @@
3028
// CHECK: (bound_generic_class TypesToReflect.GenericOC
3129
// CHECK: (class __ObjC.CFString))
3230

31+
// CHECK: TypesToReflect.GenericOC
32+
// CHECK: ------------------------
33+
3334
// CHECK: TypesToReflect.HasObjCClasses
3435
// CHECK: -----------------------------
3536
// CHECK: url: __ObjC.NSURL
@@ -60,65 +61,16 @@
6061
// CHECK-32: Stride: 16
6162
// CHECK-32: NumExtraInhabitants: 0
6263

64+
// CHECK-64: - __C.CGRect:
6365
// CHECK-64: Size: 32
6466
// CHECK-64: Alignment: 8
6567
// CHECK-64: Stride: 32
6668
// CHECK-64: NumExtraInhabitants: 0
6769

68-
// CHECK: CAPTURE DESCRIPTORS:
69-
// CHECK: ====================
70-
// CHECK: - Capture types:
71-
// CHECK: (struct Swift.StaticString)
72-
// CHECK: (struct Swift.StaticString)
73-
// CHECK: (struct Swift.UInt)
74-
// CHECK: (struct Swift.UInt)
75-
// CHECK: - Metadata sources:
76-
77-
// CHECK: - Capture types:
78-
// CHECK: (function
79-
// CHECK: (tuple))
80-
// CHECK: - Metadata sources:
81-
82-
// CHECK: - Capture types:
83-
// CHECK: (struct Swift.StaticString)
84-
// CHECK: (struct Swift.StaticString)
85-
// CHECK: (struct Swift.UInt)
86-
// CHECK: (struct Swift.UInt)
87-
// CHECK: - Metadata sources:
70+
// CHECK: CAPTURE DESCRIPTORS:
71+
// CHECK-NEXT: ====================
8872

89-
// CHECK: - Capture types:
90-
// CHECK: (function
91-
// CHECK: (tuple))
92-
// CHECK: - Metadata sources:
93-
94-
// CHECK: - Capture types:
95-
// CHECK: (class __ObjC.NSBundle)
96-
// CHECK: (protocol __ObjC.NSCoding)
97-
// CHECK: - Metadata sources:
98-
99-
// CHECK: - Capture types:
100-
// CHECK: (struct Swift.StaticString)
101-
// CHECK: (bound_generic_struct Swift.UnsafeBufferPointer
102-
// CHECK: (struct Swift.UInt8))
103-
// CHECK: (struct Swift.UInt)
104-
// CHECK: (struct Swift.UInt)
105-
// CHECK: - Metadata sources:
106-
107-
// CHECK: - Capture types:
108-
// CHECK: (function
109-
// CHECK: (tuple))
110-
// CHECK: - Metadata sources:
111-
112-
// CHECK: - Capture types:
113-
// CHECK: (bound_generic_struct Swift.UnsafeBufferPointer
114-
// CHECK: (struct Swift.UInt8))
115-
// CHECK: (bound_generic_struct Swift.UnsafeBufferPointer
116-
// CHECK: (struct Swift.UInt8))
117-
// CHECK: (struct Swift.UInt)
118-
// CHECK: (struct Swift.UInt)
119-
// CHECK: - Metadata sources:
120-
121-
// CHECK: - Capture types:
122-
// CHECK: (function
123-
// CHECK: (tuple))
124-
// CHECK: - Metadata sources:
73+
// CHECK: - Capture types:
74+
// CHECK-NEXT: (class __ObjC.NSBundle)
75+
// CHECK-NEXT: (protocol __ObjC.NSCoding)
76+
// CHECK-NEXT: - Metadata sources:

0 commit comments

Comments
 (0)