Skip to content

[6.0] Sema: Downgrade actor convenience initializer diagnostic to a warning in interfaces. #74878

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 Jul 1, 2024

  • Explanation: The convenience keyword is not accepted on actor initializers because the compiler infers this status automatically and actors cannot be subclassed. However, internally the compiler still computes whether an actor init is a convenience init and this implicit status has been leaking through accidentally in printed .swiftinterface files. This was noticed because in Swift 6 the presence of the keyword is diagnosed as an error, making .swiftinterface files unparseable for modules containing actors with convenience inits.
  • Scope: The fix changes the behavior of building modules from interfaces by relaxing a type checking constraint. This fix is important for the owners of resilient libraries who want to adopt Swift 6 because their adoption could be blocked by this bug.
  • Issue/Radar: rdar://130857256
  • Original PR: Sema: Downgrade actor convenience initializer diagnostic to a warning in interfaces #74877
  • Risk: Very low. This just relaxes a type checking constraint when checking .swiftinterface files to continue allowing syntax in Swift 6 that was already allowed in modules compiled with the Swift 5 language mode.
  • Testing: Added a new test to the compiler test suite.
  • Reviewer: @kavon

@tshortli tshortli requested a review from a team as a code owner July 1, 2024 23:25
@tshortli
Copy link
Contributor Author

tshortli commented Jul 1, 2024

@swift-ci please test

@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Jul 1, 2024
@tshortli tshortli enabled auto-merge July 1, 2024 23:42
… in interfaces.

The `convenience` keyword is not accepted on actor initializers because the
compiler infers this status automatically and actors cannot be subclassed.
However, internally the compiler still computes whether an actor init is a
convenience init and this implicit status has been leaking through accidentally
in printed `.swiftinterface` files. This was noticed because in Swift 6 the
presence of the keyword is diagnosed as an error, making `.swiftinterface`
files unparseable for modules containing actors with convenience inits.

For Swift 6, I'm just going to suppress the error in `.swiftinterface` files
regardless of language mode. In future releases of the compiler, though, it can
stop printing the `convenience` keyword on these inits altogether, though.

Resolves rdar://130857256.
@tshortli tshortli force-pushed the module-interface-suppress-actor-convenience-init-diag-6.0 branch from 1682af3 to dfdb161 Compare July 2, 2024 15:32
@tshortli
Copy link
Contributor Author

tshortli commented Jul 2, 2024

@swift-ci please test

@tshortli tshortli merged commit de144e9 into swiftlang:release/6.0 Jul 2, 2024
4 of 5 checks passed
@tshortli tshortli deleted the module-interface-suppress-actor-convenience-init-diag-6.0 branch July 3, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants