Skip to content

Conversation

@tshortli
Copy link
Contributor

When emitting SIL for if #available(Swift ..., *) queries, call the new _isSwiftRuntimeVersionAtLeast() function in the stdlib to check the condition. To support back deployment, the implementation of _isSwiftRuntimeVersionAtLeast() is @_alwaysEmitIntoClient and performs its comparison against the result of _SwiftStdlibVersion.current, which is pre-existing ABI that the stdlib exposes for querying the Swift runtime version.

Resolves rdar://162726037.

@tshortli
Copy link
Contributor Author

@swift-ci please test

#else
@available(SwiftStdlib 5.7, *)
public static var current: Self { .v6_3_0 }
public static var current: Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplication is a workaround for the fact that the parser doesn't seem to support wrapping @_noLocks in conditional compilation guards when the attribute is attached to an accessor.

@tshortli tshortli force-pushed the silgen-swift-runtime-availability branch from 1d8a4f4 to 62a255f Compare October 16, 2025 00:23
When emitting SIL for `if #available(Swift ..., *)` queries, call the new
`_isSwiftRuntimeVersionAtLeast()` function in the stdlib to check the
condition. To support back deployment, the implementation of
`_isSwiftRuntimeVersionAtLeast()` is `@_alwaysEmitIntoClient` and performs its
comparison against the result of `_SwiftStdlibVersion.current`, which is
pre-existing ABI that the stdlib exposes for querying the Swift runtime
version.

Resolves rdar://162726037.
@tshortli tshortli force-pushed the silgen-swift-runtime-availability branch from 62a255f to 085f8ec Compare October 16, 2025 05:43
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 3151bcb into swiftlang:main Oct 16, 2025
5 checks passed
@tshortli tshortli deleted the silgen-swift-runtime-availability branch October 16, 2025 22:08
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