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-7472] Compiler doesn't realize result of generic function specialized to Never doesn't ever return #50015

Closed
gregomni opened this issue Apr 18, 2018 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@gregomni
Copy link
Collaborator

Previous ID SR-7472
Radar None
Original Reporter @gregomni
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 59fda595e0dd7887bcc9432030a94a33

relates to:

  • SR-2729 Function incorrectly claims to be never executed

Issue Description:

Example code. The "nope" line below errors that the body of a guard cannot fall through.

protocol P {
    static var theThing: Self { get }
}
extension Never : P {
    static var theThing: Never { return fatalError() }
}
func test<T: P>(_ type: T.Type) -> T {
    return type.theThing
}
func f(i: Int?) {
    guard i != nil else { Never.theThing } // ok
    guard i != nil else { test(Never.self) } // nope!
}
@belkadan
Copy link
Contributor

cc @slavapestov

@gregomni
Copy link
Collaborator Author

Slava mentioned on twitter that he has a fix in process for this, related to SR-2729

@slavapestov
Copy link
Member

#17019

@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

3 participants