Skip to content

[cxx-interop] Fix test failure on older macOS #82454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions test/Interop/Cxx/foreign-reference/print-reference.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -I %S/Inputs) | %FileCheck %s
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -I %S/Inputs) | %FileCheck %s

// REQUIRES: executable_test

Expand All @@ -12,31 +12,44 @@
import Printed

func printCxxImmortalFRT() {
let s = ImmortalFRT()
print(s)
if #available(SwiftStdlib 6.2, *) {
let s = ImmortalFRT()
print(s)
} else {
print("runtime too old")
}
}

@available(SwiftStdlib 5.9, *)
extension FRTCustomStringConvertible : CustomStringConvertible {
public var description: String {
return "FRTCustomStringConvertible(publ: \(publ))"
}
}

func printCxxFRTCustomStringConvertible() {
let s = FRTCustomStringConvertible()
print(s)
if #available(SwiftStdlib 5.9, *) {
let s = FRTCustomStringConvertible()
print(s)
} else {
print("runtime too old")
}
}

func printCxxFRType() {
let s = FRType()
print(s)
if #available(SwiftStdlib 6.2, *) {
let s = FRType()
print(s)
} else {
print("runtime too old")
}
}

printCxxImmortalFRT()
// CHECK: ImmortalFRT()
// CHECK: {{ImmortalFRT()|runtime too old}}

printCxxFRTCustomStringConvertible()
// CHECK: FRTCustomStringConvertible(publ: 2)

printCxxFRType()
// CHECK: FRType()
// CHECK: {{FRType()|runtime too old}}