Skip to content

Allow return types on initializers #2541

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 1 commit into from
Mar 20, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 14, 2024

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 14, 2024 22:15
@ahoppen
Copy link
Member Author

ahoppen commented Mar 14, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 14, 2024

@swift-ci Please test Windows

@ahoppen ahoppen changed the title Allow return types of initializers Allow return types on initializers Mar 15, 2024
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 force-pushed the ahoppen/return-type-on-initializer branch from 14a867b to 3e368ca Compare March 15, 2024 13:53
@ahoppen
Copy link
Member Author

ahoppen commented Mar 15, 2024

@swift-ci Please test

@bnbarham
Copy link
Contributor

Note that this should probably go behind experimental

@ahoppen
Copy link
Member Author

ahoppen commented Mar 19, 2024

I don’t think it needs to be behind an experimental flag because the syntax tree has always allowed return types on initializers.

@ahoppen ahoppen merged commit 77efdcc into swiftlang:main Mar 20, 2024
@ahoppen ahoppen deleted the ahoppen/return-type-on-initializer branch March 20, 2024 13:41
@meg-gupta
Copy link
Contributor

Thanks!

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.

3 participants