Skip to content

[test] fix availability #80175

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
Mar 20, 2025
Merged

Conversation

glessard
Copy link
Contributor

Use the general SwiftStdlib availability rather than just macOS.

@glessard
Copy link
Contributor Author

@swift-ci please smoke test

@j-hui
Copy link
Contributor

j-hui commented Mar 20, 2025

@susmonteiro why was the @available attribute even needed in the first place? And I'm wondering whether the test should just be changed to something like this instead (similar to the test case above it):

if #available(SwiftStdlib 5.8, *) {
    VirtualMethodsTestSuite.test("C++ virtual method with complex parameter") {
        func f(simpleClass: HasDestructor, immortalClass: Immortal2) {
            immortalClass.virtualMethod(simpleClass)
        }
    }
}

@drexin drexin merged commit f9cb78b into swiftlang:main Mar 20, 2025
0 of 3 checks passed
@glessard
Copy link
Contributor Author

glessard commented Mar 20, 2025

if #available is worse, since it makes the test disappear entirely in the wrong conditions. A better approach would be the .require(.stdlib_5_8) modifier (added in #79838), which would explicitly mark the test as skipped when compiled and run with the wrong availability.

@glessard glessard deleted the virtual-methods-availability branch March 20, 2025 20:53
@susmonteiro
Copy link
Contributor

@susmonteiro why was the @available attribute even needed in the first place?

I think it's because the struct Immortal2 has swift attributes defined in IMMORTAL_FRT, which are only available from macOS 13.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants