3
3
// RUN: %gyb %s -o %t/main.swift
4
4
// RUN: if [ %target-runtime == "objc" ]; then \
5
5
// RUN: %target-clang -fobjc-arc %S/Inputs/SlurpFastEnumeration/SlurpFastEnumeration.m -c -o %t/SlurpFastEnumeration.o; \
6
- // RUN: %line-directive %t/main.swift -- %target-build-swift %S/Inputs/DictionaryKeyValueTypes.swift %S/Inputs/DictionaryKeyValueTypesObjC.swift %t/main.swift -I %S/Inputs/SlurpFastEnumeration/ -Xlinker %t/SlurpFastEnumeration.o -o %t/Array -Xfrontend -disable-access-control -swift-version 3 ; \
6
+ // RUN: %line-directive %t/main.swift -- %target-build-swift %S/Inputs/DictionaryKeyValueTypes.swift %S/Inputs/DictionaryKeyValueTypesObjC.swift %t/main.swift -I %S/Inputs/SlurpFastEnumeration/ -Xlinker %t/SlurpFastEnumeration.o -o %t/Array -Xfrontend -disable-access-control -swift-version 4.2 ; \
7
7
// RUN: else \
8
- // RUN: %line-directive %t/main.swift -- %target-build-swift %S/Inputs/DictionaryKeyValueTypes.swift %t/main.swift -o %t/Array -Xfrontend -disable-access-control -swift-version 3 ; \
8
+ // RUN: %line-directive %t/main.swift -- %target-build-swift %S/Inputs/DictionaryKeyValueTypes.swift %t/main.swift -o %t/Array -Xfrontend -disable-access-control -swift-version 4.2 ; \
9
9
// RUN: fi
10
10
// RUN: %target-codesign %t/Array && %line-directive %t/main.swift -- %target-run %t/Array
11
11
// REQUIRES: executable_test
@@ -372,7 +372,7 @@ ArrayTestSuite.test("BridgedFromObjC.Verbatim.ArrayIsCopied") {
372
372
expectEqual(30, (nsa[1] as! TestObjCValueTy).value)
373
373
374
374
// Check that the Array is not affected.
375
- expectEqual(20, result[1].value)
375
+ expectEqual(20, ( result[1] as! TestObjCValueTy) .value)
376
376
}
377
377
378
378
ArrayTestSuite.test("BridgedFromObjC.Nonverbatim.ArrayIsCopied") {
@@ -393,8 +393,8 @@ ArrayTestSuite.test("BridgedFromObjC.Nonverbatim.ArrayIsCopied") {
393
393
394
394
ArrayTestSuite.test("BridgedFromObjC.Verbatim.NSArrayIsRetained") {
395
395
let nsa = NSArray(array: getAsNSArray([ 10, 20, 30 ]))
396
- var a: Array<AnyObject> = convertNSArrayToArray(nsa)
397
- var bridgedBack: NSArray = convertArrayToNSArray(a)
396
+ let a: Array<AnyObject> = convertNSArrayToArray(nsa)
397
+ let bridgedBack: NSArray = convertArrayToNSArray(a)
398
398
399
399
expectEqual(
400
400
unsafeBitCast(nsa, to: Int.self),
@@ -407,8 +407,8 @@ ArrayTestSuite.test("BridgedFromObjC.Verbatim.NSArrayIsRetained") {
407
407
408
408
ArrayTestSuite.test("BridgedFromObjC.Nonverbatim.NSArrayIsCopied") {
409
409
let nsa = NSArray(array: getAsNSArray([ 10, 20, 30 ]))
410
- var a: Array<TestBridgedValueTy> = convertNSArrayToArray(nsa)
411
- var bridgedBack: NSArray = convertArrayToNSArray(a)
410
+ let a: Array<TestBridgedValueTy> = convertNSArrayToArray(nsa)
411
+ let bridgedBack: NSArray = convertArrayToNSArray(a)
412
412
413
413
expectNotEqual(
414
414
unsafeBitCast(nsa, to: Int.self),
@@ -542,11 +542,9 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/objectAtIndex") {
542
542
expectEqual(30, (v as! TestObjCValueTy).value)
543
543
let idValue2 = unsafeBitCast(v, to: UInt.self)
544
544
545
- for i in 0..<3 {
546
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
547
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
548
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
549
- }
545
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
546
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
547
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
550
548
551
549
expectAutoreleasedKeysAndValues(unopt: (0, 3))
552
550
}
@@ -602,11 +600,9 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/getObjects") {
602
600
expectEqual(30, (v as! TestObjCValueTy).value)
603
601
let idValue2 = unsafeBitCast(v, to: UInt.self)
604
602
605
- for i in 0..<3 {
606
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
607
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
608
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
609
- }
603
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
604
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
605
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
610
606
611
607
buffer.deallocate()
612
608
_fixLifetime(a)
@@ -815,11 +811,9 @@ ArrayTestSuite.test("BridgedToObjC/Custom/objectAtIndex") {
815
811
expectEqual(30, (v as! TestObjCValueTy).value)
816
812
let idValue2 = unsafeBitCast(v, to: UInt.self)
817
813
818
- for i in 0..<3 {
819
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
820
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
821
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
822
- }
814
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
815
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
816
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
823
817
824
818
expectEqual(3, TestBridgedValueTy.bridgeOperations)
825
819
expectAutoreleasedKeysAndValues(unopt: (0, 3))
@@ -876,11 +870,9 @@ ArrayTestSuite.test("BridgedToObjC/Custom/getObjects") {
876
870
expectEqual(30, (v as! TestObjCValueTy).value)
877
871
let idValue2 = unsafeBitCast(v, to: UInt.self)
878
872
879
- for i in 0..<3 {
880
- expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
881
- expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
882
- expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
883
- }
873
+ expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
874
+ expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
875
+ expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
884
876
885
877
buffer.deallocate()
886
878
_fixLifetime(a)
@@ -1119,14 +1111,14 @@ ArrayTestSuite.test("BridgedToObjC.Nonverbatim.RoundtripThroughSwiftArray") {
1119
1111
TestBridgedValueTy.bridgeOperations = 0
1120
1112
let nsa: NSArray = getAsImmutableNSArray([ 10, 20, 30 ])
1121
1113
let a: Array<TestBridgedValueTy> = convertNSArrayToArray(nsa)
1122
- let bridgedBack = convertArrayToNSArray(a)
1114
+ let _ = convertArrayToNSArray(a)
1123
1115
expectEqual(3, TestBridgedValueTy.bridgeOperations)
1124
1116
}
1125
1117
do {
1126
1118
TestBridgedValueTy.bridgeOperations = 0
1127
1119
let nsa: NSArray = getAsImmutableNSArray([ 10, 20, 30 ])
1128
1120
let a = nsa as! Array<TestBridgedValueTy>
1129
- let bridgedBack : NSArray = a as NSArray
1121
+ let _ : NSArray = a as NSArray
1130
1122
expectEqual(3, TestBridgedValueTy.bridgeOperations)
1131
1123
}
1132
1124
}
0 commit comments