Skip to content

Fix ByteBufferTests when compiling with Swift 6 but running on macOS 14. #3217

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

allevato
Copy link

Writing @available(someOS...) on an XCTest test method only affects whether the compiler allows known-available APIs to be called, but it doesn't actually prevent the test from running on older OSes (XCTest doesn't see the annotation since it's not part of the Objective-C runtime metadata). So if this code is compiled with Swift 6 but run on an older OS, it will segfault when it tries to call an API that doesn't exist on that platform.

These tests need to use an #available guard instead to make the decision to skip them at runtime.

Writing `@available(someOS...)` on an XCTest test method only affects
whether the compiler allows known-available APIs to be called, but it
doesn't actually prevent the test from running on older OSes (XCTest
doesn't see the annotation since it's not part of the Objective-C
runtime metadata). So if this code is compiled with Swift 6 but run
on an older OS, it will segfault when it tries to call an API that
doesn't exist on that platform.

These tests need to use an `#available` guard instead to make the
decision to skip them at runtime.
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.

1 participant