Neve-6ren">
gpt4 book ai didi

swift - 神秘的 "Will never be executed"警告

转载 作者:搜寻专家 更新时间:2023-10-31 23:09:44 26 4
gpt4 key购买 nike

我试图在这里理解“永远不会被执行”警告:

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)
}

}

又一个编译器错误?

最佳答案

Jordan Rose 在 Swift Evolution 邮件列表中回复:

Sure looks like one to me. In particular, it looks like SR-2729.

(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

链接:

https://bugs.swift.org/browse/SR-2729

关于swift - 神秘的 "Will never be executed"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44332850/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com