Skip to content

Commit ef47dd6

Browse files
committed
[cxx-interop] Re-enable a test for reference counted types
This also re-enables a test that was disabled since 2022. rdar://97532642
1 parent bd6da5d commit ef47dd6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/Interop/Cxx/foreign-reference/Inputs/reference-counted.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ __attribute__((swift_attr("release:LCRelease"))) LocalCount {
2727

2828
}
2929

30-
inline void LCRetain(NS::LocalCount *x) { x->value++; }
30+
inline void LCRetain(NS::LocalCount *x) {
31+
x->value++;
32+
finalLocalRefCount = x->value;
33+
}
3134
inline void LCRelease(NS::LocalCount *x) {
3235
x->value--;
3336
finalLocalRefCount = x->value;

test/Interop/Cxx/foreign-reference/reference-counted.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-llvm-verify)
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-llvm-verify -Xfrontend -disable-availability-checking)
22
//
33
// REQUIRES: executable_test
44
// TODO: This should work without ObjC interop in the future rdar://97497120
55
// REQUIRES: objc_interop
66

7-
// REQUIRES: rdar97532642
8-
97
import StdlibUnittest
108
import ReferenceCounted
119

@@ -17,7 +15,7 @@ public func blackHole<T>(_ _: T) { }
1715
@inline(never)
1816
func localTest() {
1917
var x = NS.LocalCount.create()
20-
expectEqual(x.value, 6) // This is 6 because of "var x" "x.value" * 2 and "(x, x, x)".
18+
expectEqual(x.value, 8) // This is 8 because of "var x" "x.value" * 2, two method calls on x, and "(x, x, x)".
2119

2220
expectEqual(x.returns42(), 42)
2321
expectEqual(x.constMethod(), 42)
@@ -35,7 +33,6 @@ ReferenceCountedTestSuite.test("Local") {
3533
var globalOptional: NS.LocalCount? = nil
3634

3735
ReferenceCountedTestSuite.test("Global optional holding local ref count") {
38-
expectEqual(finalLocalRefCount, 0)
3936
globalOptional = NS.LocalCount.create()
4037
expectEqual(finalLocalRefCount, 1)
4138
}

0 commit comments

Comments
 (0)