Skip to content

Commit db840df

Browse files
committed
Tests: Update stdlib/RuntimeObjC.swift to always link libswiftCoreGraphics.
The core definitions of CGPoint and other types were pushed down from CoreGraphics to CoreFoundation. This test indirectly depends on the conformance of those types to CustomReflectable, but nothing in the test was using those conformances explicitly and so libswiftCoreGraphics would not be auto-linked when the test is compiled at a high enough deployment target. Use the conformances directly to force linkage. Resolves rdar://121343931
1 parent d0244d7 commit db840df

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

test/stdlib/RuntimeObjC.swift

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ func withSwiftObjectCanary<T>(
171171
expectEqual(0, swiftObjectCanaryCount, stackTrace: stackTrace)
172172
}
173173

174+
// Hack to ensure the CustomReflectable conformance is used directly by the test
175+
// in case it comes from a library that would otherwise not be autolinked.
176+
@inline(never)
177+
func assertCustomReflectable<T: CustomReflectable>(_ t: T) {}
178+
174179
var Runtime = TestSuite("Runtime")
175180

176181
func _isClassOrObjCExistential_Opaque<T>(_ x: T.Type) -> Bool {
@@ -614,7 +619,9 @@ Reflection.test("MetatypeMirror") {
614619

615620
Reflection.test("CGPoint") {
616621
var output = ""
617-
dump(CGPoint(x: 1.25, y: 2.75), to: &output)
622+
let point = CGPoint(x: 1.25, y: 2.75)
623+
assertCustomReflectable(point)
624+
dump(point, to: &output)
618625

619626
let expected =
620627
"▿ (1.25, 2.75)\n" +
@@ -626,7 +633,9 @@ Reflection.test("CGPoint") {
626633

627634
Reflection.test("CGSize") {
628635
var output = ""
629-
dump(CGSize(width: 1.25, height: 2.75), to: &output)
636+
let size = CGSize(width: 1.25, height: 2.75)
637+
assertCustomReflectable(size)
638+
dump(size, to: &output)
630639

631640
let expected =
632641
"▿ (1.25, 2.75)\n" +
@@ -638,11 +647,11 @@ Reflection.test("CGSize") {
638647

639648
Reflection.test("CGRect") {
640649
var output = ""
641-
dump(
642-
CGRect(
643-
origin: CGPoint(x: 1.25, y: 2.25),
644-
size: CGSize(width: 10.25, height: 11.75)),
645-
to: &output)
650+
let rect = CGRect(
651+
origin: CGPoint(x: 1.25, y: 2.25),
652+
size: CGSize(width: 10.25, height: 11.75))
653+
assertCustomReflectable(rect)
654+
dump(rect, to: &output)
646655

647656
let expected =
648657
"▿ (1.25, 2.25, 10.25, 11.75)\n" +

0 commit comments

Comments
 (0)