Skip to content

[6.0][AST/Sema] Make it possible to use init accessors in inlinable initializers #75243

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 5 commits into from
Sep 3, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jul 15, 2024

  • Explanation:

    Fixes a SILGen crash-on-invalid when init accessors are referenced in inlinable initialzers without explicit @usableFromInline attribute.

    • Make init accessors internal
    • Require explicit @usableFromInline on init accessor when property is used in a designated inlinable initializer
    • Improve diagnostics when @usableFromInline is applied to a declaration without a name (i.e. accessor/init)
  • Main Branch PR: [AST/Sema] Make it possible to use init accessors in inlinable initializers #75191

  • Resolves: rdar://129318806

  • Risk: Low (Diagnoses invalid code instead of crashing and allows more uses of init accessors in accordance with the proposal).

  • Reviewed By: @tshortli

  • Testing: Existing test-cases were modified and new tests were added.

xedin added 4 commits July 15, 2024 09:21
This allows them to be used across files in the same module
and requires explicit `@usableFromInline` annotation to be
used inside of `@_alwaysEmitIntoClient` and `@inlinable`
initializers.

(cherry picked from commit dbe151b)
…claration without a name (i.e. accessor/init)

(cherry picked from commit 6925940)
…xts if they are not marked as `@usableFromInline`

(cherry picked from commit 123068c)
Using init accessors from inlinable code requires `@usableFromInline`
annotation, which means that we need to print them in swift interfaces
and serialize them.

(cherry picked from commit be33968)
@xedin xedin requested a review from hborla July 15, 2024 16:25
@xedin xedin requested a review from a team as a code owner July 15, 2024 16:25
@xedin
Copy link
Contributor Author

xedin commented Jul 15, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jul 15, 2024

@swift-ci please test

@xedin xedin added swift 6.0 🍒 release cherry pick Flag: Release branch cherry picks labels Jul 18, 2024
@xedin
Copy link
Contributor Author

xedin commented Jul 18, 2024

@swift-ci please test

@hborla hborla marked this pull request as draft August 12, 2024 18:55
@hborla
Copy link
Member

hborla commented Aug 12, 2024

This change is not targeting 6.0. I've converted this to a draft until we have a release/6.0.0 branch, freeing up release/6.0 for other potential point release changes.

@xedin
Copy link
Contributor Author

xedin commented Aug 23, 2024

@swift-ci please test

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Sep 3, 2024

@swift-ci please test

@xedin xedin marked this pull request as ready for review September 3, 2024 20:24
@xedin xedin merged commit 6d160a2 into swiftlang:release/6.0 Sep 3, 2024
5 checks passed
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