Skip to content
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

[SR-8434] Don't require a return in functions that take an uninhabited type #50957

Closed
mdiep opened this issue Aug 1, 2018 · 2 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mdiep
Copy link
Contributor

mdiep commented Aug 1, 2018

Previous ID SR-8434
Radar None
Original Reporter @mdiep
Type Bug
Status Resolved
Resolution Done
Environment

Swift 4.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @theblixguy
Priority Medium

md5: b06324695f5e01392b38d15797b30528

relates to:

  • SR-8766 Allow returning self from instance procedure on an uninhabited type whose return type is that uninhabited type

Issue Description:

func f(_: Never) -> Int {}

1:26: error: missing return in a function expected to return 'Int'
func f(_: Never) -> Int {}

That shouldn't be an error. This function can never be called, so no return is actually needed.

@mdiep
Copy link
Contributor Author

mdiep commented Aug 1, 2018

Swift should also warn if there is code in such a function (SR-8435).

@theblixguy
Copy link
Collaborator

PR: #20528

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants