@@ -291,13 +291,13 @@ class CustomImmutableNSArray : NSArray {
291
291
}
292
292
293
293
@objc(copyWithZone:)
294
- override func copy(with zone: NSZone?) -> AnyObject {
294
+ override func copy(with zone: NSZone?) -> Any {
295
295
CustomImmutableNSArray.timesCopyWithZoneWasCalled += 1
296
296
return self
297
297
}
298
298
299
299
@objc
300
- override func object(at index: Int) -> AnyObject {
300
+ override func object(at index: Int) -> Any {
301
301
CustomImmutableNSArray.timesObjectAtIndexWasCalled += 1
302
302
return _data[index]
303
303
}
@@ -535,22 +535,22 @@ for index in [ -100, -1, 3, 4, 100 ] {
535
535
ArrayTestSuite.test("BridgedToObjC/Verbatim/objectAtIndex") {
536
536
let a = getBridgedNSArrayOfRefTypeVerbatimBridged(numElements: 3)
537
537
538
- var v: AnyObject = a.object(at: 0)
538
+ var v: AnyObject = a.object(at: 0) as AnyObject
539
539
expectEqual(10, (v as! TestObjCValueTy).value)
540
540
let idValue0 = unsafeBitCast(v, to: UInt.self)
541
541
542
- v = a.object(at: 1)
542
+ v = a.object(at: 1) as AnyObject
543
543
expectEqual(20, (v as! TestObjCValueTy).value)
544
544
let idValue1 = unsafeBitCast(v, to: UInt.self)
545
545
546
- v = a.object(at: 2)
546
+ v = a.object(at: 2) as AnyObject
547
547
expectEqual(30, (v as! TestObjCValueTy).value)
548
548
let idValue2 = unsafeBitCast(v, to: UInt.self)
549
549
550
550
for i in 0..<3 {
551
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
552
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
553
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
551
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
552
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
553
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
554
554
}
555
555
556
556
expectAutoreleasedKeysAndValues(unopt: (0, 3))
@@ -608,9 +608,9 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/getObjects") {
608
608
let idValue2 = unsafeBitCast(v, to: UInt.self)
609
609
610
610
for i in 0..<3 {
611
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
612
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
613
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
611
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
612
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
613
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
614
614
}
615
615
616
616
buffer.deallocate(capacity: 3)
@@ -621,7 +621,7 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/getObjects") {
621
621
622
622
ArrayTestSuite.test("BridgedToObjC/Verbatim/copyWithZone") {
623
623
let a = getBridgedNSArrayOfRefTypeVerbatimBridged(numElements: 3)
624
- let copy: AnyObject = a.copy(with: nil)
624
+ let copy: AnyObject = a.copy(with: nil) as AnyObject
625
625
expectEqual(
626
626
unsafeBitCast(a, to: UInt.self), unsafeBitCast(copy, to: UInt.self))
627
627
}
@@ -707,15 +707,15 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/ObjectEnumerator/FastEnumeration/Use
707
707
ArrayTestSuite.test("BridgedToObjC/Verbatim/BridgeBack/Reallocate") {
708
708
let a = getBridgedNSArrayOfRefTypeVerbatimBridged(numElements: 3)
709
709
710
- var v: AnyObject = a[0]
710
+ var v: AnyObject = a[0] as AnyObject
711
711
expectEqual(10, (v as! TestObjCValueTy).value)
712
712
let idValue0 = unsafeBitCast(v, to: UInt.self)
713
713
714
- v = a[1]
714
+ v = a[1] as AnyObject
715
715
expectEqual(20, (v as! TestObjCValueTy).value)
716
716
let idValue1 = unsafeBitCast(v, to: UInt.self)
717
717
718
- v = a[2]
718
+ v = a[2] as AnyObject
719
719
expectEqual(30, (v as! TestObjCValueTy).value)
720
720
let idValue2 = unsafeBitCast(v, to: UInt.self)
721
721
@@ -731,9 +731,9 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/BridgeBack/Reallocate") {
731
731
732
732
// Check that mutating the native array did not affect the bridged array.
733
733
expectEqual(3, a.count)
734
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
735
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
736
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
734
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
735
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
736
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
737
737
738
738
expectAutoreleasedKeysAndValues(unopt: (0, 3))
739
739
}
@@ -808,22 +808,22 @@ for index in [ -100, -1, 3, 4, 100 ] {
808
808
ArrayTestSuite.test("BridgedToObjC/Custom/objectAtIndex") {
809
809
let a = getBridgedNSArrayOfValueTypeCustomBridged(numElements: 3)
810
810
811
- var v: AnyObject = a.object(at: 0)
811
+ var v: AnyObject = a.object(at: 0) as AnyObject
812
812
expectEqual(10, (v as! TestObjCValueTy).value)
813
813
let idValue0 = unsafeBitCast(v, to: UInt.self)
814
814
815
- v = a.object(at: 1)
815
+ v = a.object(at: 1) as AnyObject
816
816
expectEqual(20, (v as! TestObjCValueTy).value)
817
817
let idValue1 = unsafeBitCast(v, to: UInt.self)
818
818
819
- v = a.object(at: 2)
819
+ v = a.object(at: 2) as AnyObject
820
820
expectEqual(30, (v as! TestObjCValueTy).value)
821
821
let idValue2 = unsafeBitCast(v, to: UInt.self)
822
822
823
823
for i in 0..<3 {
824
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
825
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
826
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
824
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
825
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
826
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
827
827
}
828
828
829
829
expectEqual(3, TestBridgedValueTy.bridgeOperations)
@@ -882,9 +882,9 @@ ArrayTestSuite.test("BridgedToObjC/Custom/getObjects") {
882
882
let idValue2 = unsafeBitCast(v, to: UInt.self)
883
883
884
884
for i in 0..<3 {
885
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
886
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
887
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
885
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
886
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
887
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
888
888
}
889
889
890
890
buffer.deallocate(capacity: 3)
@@ -896,7 +896,7 @@ ArrayTestSuite.test("BridgedToObjC/Custom/getObjects") {
896
896
897
897
ArrayTestSuite.test("BridgedToObjC/Custom/copyWithZone") {
898
898
let a = getBridgedNSArrayOfValueTypeCustomBridged(numElements: 3)
899
- let copy: AnyObject = a.copy(with: nil)
899
+ let copy: AnyObject = a.copy(with: nil) as AnyObject
900
900
expectEqual(
901
901
unsafeBitCast(a, to: UInt.self),
902
902
unsafeBitCast(copy, to: UInt.self))
@@ -1001,15 +1001,15 @@ ArrayTestSuite.test("BridgedToObjC/Custom/ObjectEnumerator/FastEnumeration/UseFr
1001
1001
ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Cast") {
1002
1002
let a = getBridgedNSArrayOfValueTypeCustomBridged(numElements: 3)
1003
1003
1004
- var v: AnyObject = a[0]
1004
+ var v: AnyObject = a[0] as AnyObject
1005
1005
expectEqual(10, (v as! TestObjCValueTy).value)
1006
1006
let idValue0 = unsafeBitCast(v, to: UInt.self)
1007
1007
1008
- v = a[1]
1008
+ v = a[1] as AnyObject
1009
1009
expectEqual(20, (v as! TestObjCValueTy).value)
1010
1010
let idValue1 = unsafeBitCast(v, to: UInt.self)
1011
1011
1012
- v = a[2]
1012
+ v = a[2] as AnyObject
1013
1013
expectEqual(30, (v as! TestObjCValueTy).value)
1014
1014
let idValue2 = unsafeBitCast(v, to: UInt.self)
1015
1015
@@ -1025,25 +1025,25 @@ ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Cast") {
1025
1025
1026
1026
// Check that mutating the native array did not affect the bridged array.
1027
1027
expectEqual(3, a.count)
1028
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
1029
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
1030
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
1028
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
1029
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
1030
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
1031
1031
1032
1032
expectAutoreleasedKeysAndValues(unopt: (0, 3))
1033
1033
}
1034
1034
1035
1035
ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Reallocate") {
1036
1036
let a = getBridgedNSArrayOfValueTypeCustomBridged(numElements: 3)
1037
1037
1038
- var v: AnyObject = a[0]
1038
+ var v: AnyObject = a[0] as AnyObject
1039
1039
expectEqual(10, (v as! TestObjCValueTy).value)
1040
1040
let idValue0 = unsafeBitCast(v, to: UInt.self)
1041
1041
1042
- v = a[1]
1042
+ v = a[1] as AnyObject
1043
1043
expectEqual(20, (v as! TestObjCValueTy).value)
1044
1044
let idValue1 = unsafeBitCast(v, to: UInt.self)
1045
1045
1046
- v = a[2]
1046
+ v = a[2] as AnyObject
1047
1047
expectEqual(30, (v as! TestObjCValueTy).value)
1048
1048
let idValue2 = unsafeBitCast(v, to: UInt.self)
1049
1049
@@ -1059,9 +1059,9 @@ ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Reallocate") {
1059
1059
1060
1060
// Check that mutating the native array did not affect the bridged array.
1061
1061
expectEqual(3, a.count)
1062
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0), to: UInt.self))
1063
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1), to: UInt.self))
1064
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2), to: UInt.self))
1062
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject , to: UInt.self))
1063
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject , to: UInt.self))
1064
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject , to: UInt.self))
1065
1065
1066
1066
expectAutoreleasedKeysAndValues(unopt: (0, 3))
1067
1067
}
0 commit comments