Skip to content

[6.0] Allow return types on initializers #2561

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 22, 2024

  • Explanation: SE-2305 allows returning Self and Self? from initializers so that the return type can be annotated with _borrow(a) etc. So we need to allow return clauses on initializers.
  • Scope: Parsing of initializers that have a return clause
  • Risk: I don’t see a risk in this change
  • Testing: Added a regression test
  • Issue: rdar://123905900
  • Reviewer: @bnbarham on Allow return types on initializers #2541

(yes, this is the same as #2553 but that PR accidentally targeted main instead of release/6.0)

SE-2305 allows returning `Self` and `Self?` from initializers so that the return type can be annotated with `_borrow(a)` etc.

So we need to allow return clauses on initializers.

rdar://123905900
@ahoppen ahoppen requested a review from bnbarham as a code owner March 22, 2024 12:50
@ahoppen ahoppen merged commit e66b92f into swiftlang:release/6.0 Mar 22, 2024
@ahoppen ahoppen deleted the ahoppen/6.0/return-type-on-initializer branch March 22, 2024 12:51
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