Skip to content

Commit 8ba6868

Browse files
committed
Fix stdlib/Dictionary tests for copy-propagation.
[NSArray getObjects] does not retain the objects.
1 parent 9a015f3 commit 8ba6868

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

validation-test/stdlib/Dictionary.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,6 +3887,8 @@ func checkGetObjectsAndKeys(
38873887
values.deinitialize(count: storageSize) // noop
38883888
values.deallocate()
38893889
withExtendedLifetime(canary) {}
3890+
// [NSArray getObjects] does not retain the objects, so keep the dictionary alive.
3891+
withExtendedLifetime(dictionary) {}
38903892
}
38913893

38923894
DictionaryTestSuite.test("BridgedToObjC.Verbatim.getObjects:andKeys:count:") {
@@ -5080,6 +5082,8 @@ DictionaryTestSuite.test("getObjects:andKeys:count:") {
50805082
d.available_getObjects(vp, andKeys: kp, count: 2)
50815083
expectEqual(expectedKeys, Array(keys))
50825084
expectEqual(expectedValues, Array(values))
5085+
// [NSArray getObjects] does not retain the objects, so keep the dictionary alive.
5086+
withExtendedLifetime(d) {}
50835087
}
50845088
#endif
50855089

0 commit comments

Comments
 (0)