Mysterious “Will never be executed” warning

I'm trying to understand "Will never be executed" warning here:

protocol FatalErrorReporterInterface {

    func fail(_ message: String) -> Never

}

final class FatalErrorReporter: FatalErrorReporterInterface {

    // This line emits "Will never be executed" warning
    func fail(_ message: String) -> Never {
        fatalError(message)
    }

}
Yet another compiler bug?

R+

Sure looks like one to me. In particular, it looks like SR-2729 <https://bugs.swift.org/browse/SR-2729&gt;\.

(I suspect this is because calling the method through the protocol generates a bit of wrapper code that then calls the original method; that wrapper code doesn’t have a location of its own.)

Sorry for the trouble,
Jordan

···

On Jun 2, 2017, at 08:48, Rudolf Adamkovič via swift-users <swift-users@swift.org> wrote:

I'm trying to understand "Will never be executed" warning here:

protocol FatalErrorReporterInterface {

    func fail(_ message: String) -> Never

}

final class FatalErrorReporter: FatalErrorReporterInterface {

    // This line emits "Will never be executed" warning
    func fail(_ message: String) -> Never {
        fatalError(message)
    }

}
Yet another compiler bug?

swift - Mysterious "Will never be executed" warning - Stack Overflow

R+
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users