You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ xcodebuild -version
Xcode 8.2.1
Build version 8C1002
$ swift build --version
Apple Swift Package Manager - Swift 3.0.2 (swiftpm-11750)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: ecdf0cb654b8102fdf29aa61c8f56466
Issue Description:
Using the Never type in other types gives misleading compiler warning and errors, unless it's used correctly as a return type.
extensionNever: Error {}
structSomeError: Error {}
functhrowButNoReturn() throws -> Never { throwSomeError() }
_ = try? throwButNoReturn()
// UNEXPECTED: warning: will never be executedprint("made it!")
do {
trythrowButNoReturn()
}
// EXPECTING: warning: will never be executedcatchisNever {
fatalError("never")
}
enumAction {
// EXPECTING: error: Never cannot be used as an associated value in an enumcaseyouDown(Never)
casegiveYouUp(Never)
}
funcgoingTo() -> Action { exit(EXIT_SUCCESS) }
switchgoingTo() {
caselet .youDown(x):
break// UNEXPECTED: error: Switch must be exhaustive, consider adding a default clause// If Never is allowed in an enum then those cases cannot be reached
}
// EXPECTING: warning: will never be executedexit(EXIT_SUCCESS)
// CORRECT: warning: will never be executedexit(EXIT_FAILURE)
Attachment: Download
Environment
$ xcodebuild -version
Xcode 8.2.1
Build version 8C1002
$ swift build --version
Apple Swift Package Manager - Swift 3.0.2 (swiftpm-11750)
Additional Detail from JIRA
md5: ecdf0cb654b8102fdf29aa61c8f56466
Issue Description:
Using the
Never
type in other types gives misleading compiler warning and errors, unless it's used correctly as a return type.Steps to reproduce:
The text was updated successfully, but these errors were encountered: