@@ -26,10 +26,11 @@ public func condCast<NS, T>(_ ns: NS) -> T? {
26
26
}
27
27
28
28
// Check optimizations of casts from NSString to String
29
-
30
- let nsString : NSString = " string "
31
- let swiftString : String = " string "
32
- let cfString : CFString = " string " as CFString
29
+ //
30
+ // Use
31
+ let nsString : NSString = " string🍕 "
32
+ let swiftString : String = " string🍕 "
33
+ let cfString : CFString = " string🍕 " as CFString
33
34
34
35
Tests . test ( " NSString => String " ) {
35
36
do {
@@ -39,7 +40,7 @@ Tests.test("NSString => String") {
39
40
40
41
do {
41
42
let o : String ? = condCast ( nsString)
42
- expectEqual ( o!, " string " )
43
+ expectEqual ( o!, swiftString )
43
44
}
44
45
}
45
46
@@ -50,7 +51,7 @@ Tests.test("NSString => Array<Int>. Crashing test case") {
50
51
}
51
52
52
53
// CHECK-LABEL: [ RUN ] BridgedCastFolding.NSString => Array<Int>. Crashing test case
53
- // CHECK: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSArray' (0x{{[0-9a-f]*}}).
54
+ // CHECK: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSArray' (0x{{[0-9a-f]*}}).
54
55
// CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
55
56
// CHECK: [ OK ] BridgedCastFolding.NSString => Array<Int>. Crashing test case
56
57
@@ -140,13 +141,13 @@ Tests.test("NSNumber (Int) -> String. Crashing test.") {
140
141
141
142
let nsArrInt : NSArray = [ 1 , 2 , 3 , 4 ]
142
143
let nsArrDouble : NSArray = [ 1.1 , 2.2 , 3.3 , 4.4 ]
143
- let nsArrString : NSArray = [ " One " , " Two " , " Three " , " Four " ]
144
+ let nsArrString : NSArray = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ]
144
145
let swiftArrInt : [ Int ] = [ 1 , 2 , 3 , 4 ]
145
146
let swiftArrDouble : [ Double ] = [ 1.1 , 2.2 , 3.3 , 4.4 ]
146
- let swiftArrString : [ String ] = [ " One " , " Two " , " Three " , " Four " ]
147
+ let swiftArrString : [ String ] = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ]
147
148
let cfArrInt : CFArray = [ 1 , 2 , 3 , 4 ] as CFArray
148
149
let cfArrDouble : CFArray = [ 1.1 , 2.2 , 3.3 , 4.4 ] as CFArray
149
- let cfArrString : CFArray = [ " One " , " Two " , " Three " , " Four " ] as CFArray
150
+ let cfArrString : CFArray = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ] as CFArray
150
151
151
152
Tests . test ( " NSArray -> Swift Array " ) {
152
153
do {
@@ -187,12 +188,12 @@ Tests.test("NSArray (String) -> Swift Array (Int). Crashing.") {
187
188
}
188
189
189
190
// CHECK-LABEL: [ RUN ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
190
- // CHECK: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
191
+ // CHECK: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
191
192
// CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
192
193
// CHECK: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
193
194
194
195
// CHECK-OPT-LABEL: [ RUN ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
195
- // CHECK-OPT: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
196
+ // CHECK-OPT: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
196
197
// CHECK-OPT: stderr>>> OK: saw expected "crashed: sigabrt"
197
198
// CHECK-OPT: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
198
199
expectCrashLater ( )
@@ -209,11 +210,11 @@ Tests.test("NSArray (String) -> Swift Array (Double). Crashing.") {
209
210
}
210
211
211
212
// CHECK-LABEL: [ RUN ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
212
- // CHECK: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
213
+ // CHECK: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
213
214
// CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
214
215
// CHECK: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
215
216
// CHECK-OPT-LABEL: [ RUN ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
216
- // CHECK-OPT: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
217
+ // CHECK-OPT: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
217
218
// CHECK-OPT: stderr>>> OK: saw expected "crashed: sigabrt"
218
219
// CHECK-OPT: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
219
220
expectCrashLater ( )
@@ -249,13 +250,13 @@ Tests.test("NSArray (Int) -> Swift Array (String). Crashing.") {
249
250
250
251
let swiftDictInt : [ Int : Int ] = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ]
251
252
let swiftDictDouble : [ Double : Double ] = [ 1.1 : 1.1 , 2.2 : 2.2 , 3.3 : 3.3 , 4.4 : 4.4 ]
252
- let swiftDictString : [ String : String ] = [ " One " : " One " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ]
253
+ let swiftDictString : [ String : String ] = [ " One🍕 " : " One🍕 " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ]
253
254
let nsDictInt : NSDictionary = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ]
254
255
let nsDictDouble : NSDictionary = [ 1.1 : 1.1 , 2.2 : 2.2 , 3.3 : 3.3 , 4.4 : 4.4 ]
255
- let nsDictString : NSDictionary = [ " One " : " One " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ]
256
+ let nsDictString : NSDictionary = [ " One🍕 " : " One🍕 " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ]
256
257
let cfDictInt : CFDictionary = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ] as CFDictionary
257
258
let cfDictDouble : CFDictionary = [ 1.1 : 1.1 , 2.2 : 2.2 , 3.3 : 3.3 , 4.4 : 4.4 ] as CFDictionary
258
- let cfDictString : CFDictionary = [ " One " : " One " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ] as CFDictionary
259
+ let cfDictString : CFDictionary = [ " One🍕 " : " One🍕 " , " Two " : " Two " , " Three " : " Three " , " Four " : " Four " ] as CFDictionary
259
260
260
261
Tests . test ( " NSDictionary -> Swift (Dictionary) " ) {
261
262
do {
@@ -323,13 +324,13 @@ Tests.test("NSDictionary -> Swift (Dictionary). Crashing Test Cases") {
323
324
324
325
let swiftSetInt : Set < Int > = [ 1 , 2 , 3 , 4 ]
325
326
let swiftSetDouble : Set < Double > = [ 1.1 , 2.2 , 3.3 , 4.4 ]
326
- let swiftSetString : Set < String > = [ " One " , " Two " , " Three " , " Four " ]
327
+ let swiftSetString : Set < String > = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ]
327
328
let nsSetInt : NSSet = [ 1 , 2 , 3 , 4 ]
328
329
let nsSetDouble : NSSet = [ 1.1 , 2.2 , 3.3 , 4.4 ]
329
- let nsSetString : NSSet = [ " One " , " Two " , " Three " , " Four " ]
330
+ let nsSetString : NSSet = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ]
330
331
let cfSetInt : CFSet = [ 1 , 2 , 3 , 4 ] as NSSet
331
332
let cfSetDouble : CFSet = [ 1.1 , 2.2 , 3.3 , 4.4 ] as NSSet
332
- let cfSetString : CFSet = [ " One " , " Two " , " Three " , " Four " ] as NSSet
333
+ let cfSetString : CFSet = [ " One🍕 " , " Two🍕 " , " Three🍕 " , " Four🍕 " ] as NSSet
333
334
334
335
Tests . test ( " NSSet -> Swift Set " ) {
335
336
do {
@@ -386,7 +387,7 @@ Tests.test("String -> NSNumber. Crashing Test Case") {
386
387
}
387
388
388
389
// CHECK-LABEL: [ RUN ] BridgedCastFolding.String -> NSNumber. Crashing Test Case
389
- // CHECK: stderr>>> Could not cast value of type 'NSTaggedPointerString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
390
+ // CHECK: stderr>>> Could not cast value of type '__NSCFString ' (0x{{[0-9a-f]*}}) to 'NSNumber' (0x{{[0-9a-f]*}}).
390
391
// CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
391
392
// CHECK: [ OK ] BridgedCastFolding.String -> NSNumber. Crashing Test Case
392
393
0 commit comments