@@ -26,10 +26,11 @@ public func condCast<NS, T>(_ ns: NS) -> T? {
2626}
2727
2828// 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
3334
3435Tests . test ( " NSString => String " ) {
3536 do {
@@ -39,7 +40,7 @@ Tests.test("NSString => String") {
3940
4041 do {
4142 let o : String ? = condCast ( nsString)
42- expectEqual ( o!, " string " )
43+ expectEqual ( o!, swiftString )
4344 }
4445}
4546
@@ -50,7 +51,7 @@ Tests.test("NSString => Array<Int>. Crashing test case") {
5051 }
5152
5253 // 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]*}}).
5455 // CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
5556 // CHECK: [ OK ] BridgedCastFolding.NSString => Array<Int>. Crashing test case
5657
@@ -140,13 +141,13 @@ Tests.test("NSNumber (Int) -> String. Crashing test.") {
140141
141142let nsArrInt : NSArray = [ 1 , 2 , 3 , 4 ]
142143let 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🍕 " ]
144145let swiftArrInt : [ Int ] = [ 1 , 2 , 3 , 4 ]
145146let 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🍕 " ]
147148let cfArrInt : CFArray = [ 1 , 2 , 3 , 4 ] as CFArray
148149let 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
150151
151152Tests . test ( " NSArray -> Swift Array " ) {
152153 do {
@@ -187,12 +188,12 @@ Tests.test("NSArray (String) -> Swift Array (Int). Crashing.") {
187188 }
188189
189190 // 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]*}}).
191192 // CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
192193 // CHECK: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
193194
194195 // 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]*}}).
196197 // CHECK-OPT: stderr>>> OK: saw expected "crashed: sigabrt"
197198 // CHECK-OPT: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Int). Crashing.
198199 expectCrashLater ( )
@@ -209,11 +210,11 @@ Tests.test("NSArray (String) -> Swift Array (Double). Crashing.") {
209210 }
210211
211212 // 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]*}}).
213214 // CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
214215 // CHECK: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
215216 // 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]*}}).
217218 // CHECK-OPT: stderr>>> OK: saw expected "crashed: sigabrt"
218219 // CHECK-OPT: [ OK ] BridgedCastFolding.NSArray (String) -> Swift Array (Double). Crashing.
219220 expectCrashLater ( )
@@ -249,13 +250,13 @@ Tests.test("NSArray (Int) -> Swift Array (String). Crashing.") {
249250
250251let swiftDictInt : [ Int : Int ] = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ]
251252let 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 " ]
253254let nsDictInt : NSDictionary = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ]
254255let 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 " ]
256257let cfDictInt : CFDictionary = [ 1 : 1 , 2 : 2 , 3 : 3 , 4 : 4 ] as CFDictionary
257258let 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
259260
260261Tests . test ( " NSDictionary -> Swift (Dictionary) " ) {
261262 do {
@@ -323,13 +324,13 @@ Tests.test("NSDictionary -> Swift (Dictionary). Crashing Test Cases") {
323324
324325let swiftSetInt : Set < Int > = [ 1 , 2 , 3 , 4 ]
325326let 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🍕 " ]
327328let nsSetInt : NSSet = [ 1 , 2 , 3 , 4 ]
328329let 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🍕 " ]
330331let cfSetInt : CFSet = [ 1 , 2 , 3 , 4 ] as NSSet
331332let 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
333334
334335Tests . test ( " NSSet -> Swift Set " ) {
335336 do {
@@ -386,7 +387,7 @@ Tests.test("String -> NSNumber. Crashing Test Case") {
386387 }
387388
388389 // 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]*}}).
390391 // CHECK: stderr>>> OK: saw expected "crashed: sigabrt"
391392 // CHECK: [ OK ] BridgedCastFolding.String -> NSNumber. Crashing Test Case
392393
0 commit comments