Skip to content

Sema: Relax availability checking for @MainActor #64412

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Mar 16, 2023

The @MainActor global actor constraint on a declaration does not carry an inherent ABI impact and therefore use of this constraint should not be limited to OS versions where Swift concurrency is available.

This fixes a regression (introduced by #60672) in swiftinterface typechecking for modules that contain public types that implicitly inherit a @MainActor attribute.

Resolves rdar://105610970

@tshortli tshortli force-pushed the relax-unsafe-main-actor-availability-checking branch from 8754638 to 47e32f2 Compare March 16, 2023 15:54
@tshortli tshortli requested a review from DougGregor March 16, 2023 15:56
@tshortli tshortli marked this pull request as ready for review March 16, 2023 15:58
@tshortli tshortli force-pushed the relax-unsafe-main-actor-availability-checking branch from 47e32f2 to 11fb3d8 Compare March 16, 2023 21:22
The `@MainActor` global actor constraint on a declaration does not carry an
inherent ABI impact and therefore use of this constraint should not be limited
to OS versions where Swift concurrency is available.

Resolves rdar://105610970
@tshortli tshortli force-pushed the relax-unsafe-main-actor-availability-checking branch from 11fb3d8 to fb03b4a Compare March 16, 2023 21:24
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli changed the title Sema: Relax availability checking for @MainActor(unsafe) Sema: Relax availability checking for @MainActor Mar 16, 2023
@tshortli
Copy link
Contributor Author

After discussing with Doug, I've updated the PR to relax availability checking on the @MainActor attribute in general, rather than restricting it to @MainActor(unsafe).

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 22, 2023

Can we cherry-pick this PR to release/5.8? Otherwise Xcode 14.3 with Swift 5.8.0 will break many downstream xcframeworks consumers. If this is too late for Swift 5.8.0, will it be released with Swift 5.8.1?

@RamblinWreck77
Copy link

Upgraded to Xcode 14.3 RC1 today and ran into this issue, I agree with @Kyle-Ye this will likely cause a lot of commotion once 14.3 is fully released (next week?)

@tshortli
Copy link
Contributor Author

Cherry-picked to release/5.8: #64538

@tshortli
Copy link
Contributor Author

This is fixed in Xcode 14.3 RC 2: Xcode 14.3 RC 2 Release Notes | Apple Developer Documentation

@tiwoc
Copy link

tiwoc commented Jun 6, 2023

This bug seems to be back in Xcode 15 beta 1 (15A5160n) with Swift 5.9.0.114.6. I'm seeing the "this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.114.6 clang-1500.0.27.1)')" error in a project that compiled fine with Xcode 14.3.1 (Swift 5.8), and with an XCFramework that was definitely built with BUILD_LIBRARY_FOR_DISTRIBUTION turned on.

Has the fix not made it to the Swift 5.9 branch yet? 🤔

@tshortli
Copy link
Contributor Author

tshortli commented Jun 7, 2023

@tiwoc Seeing this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.114.6 clang-1500.0.27.1)') by itself doesn't indicate that you're seeing the issue that was reported and fixed here. That error message is a generic error message printed by the compiler whenever it can't build a module from its swiftinterface for any reason, and there are myriad reasons why a swiftinterface might be unbuildable.

I recommend either filing a GitHub issue or a Feedback with the full build log that includes the errors that were emitted before the this SDK is not supported message and also a reproducer project if possible.

@tiwoc
Copy link

tiwoc commented Jun 7, 2023

Thanks for the clarification, @tshortli!

KishanBagaria added a commit to TextsHQ/BetterSwiftAX that referenced this pull request Jun 9, 2024
known issue in xcode 14.3

swiftlang/swift#64412

cannot fix without compiler changes
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