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-7841] Function returning associated type Never claims to be never executed #50377

Closed
akashivskyy opened this issue Jun 1, 2018 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@akashivskyy
Copy link

Previous ID SR-7841
Radar rdar://problem/40722856
Original Reporter @akashivskyy
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 9.3 (9E145)

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

md5: fc23cb887efb2171f1b4a2a3c5f6442e

relates to:

  • SR-2729 Function incorrectly claims to be never executed

Issue Description:

Consider the following code:

protocol P {
    associatedtype A
    func f() -> A
}

struct S: P {
    typealias A = Never
    func f() -> Never {
        print("it actually was executed")
        fatalError()
    }
}

S().f()

It produces the following warning:

    func f() -> Never {
         ^ Will never be executed

And the following output, proving that the warning is bogus:

it actually was executed
Fatal error: file macos.playground, line 10

Screenshot from Xcode:

@belkadan
Copy link
Contributor

belkadan commented Jun 1, 2018

That's a pretty bad diagnostic misfire! Thanks, Adrian.

@swift-ci create

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

3 participants