This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol DoSomething { | |
func f() | |
} | |
enum Empty {} | |
extension Empty: DoSomething { | |
func f() {} | |
} | |
struct Container { | |
var y: Empty | |
} | |
extension Container: DoSomething { | |
func f() { | |
y.f() | |
} | |
} | |
func g(_ x: Empty) { | |
print(1) | |
} | |
/* | |
a.swift:22:5: warning: will never be executed | |
print(1) | |
^ | |
a.swift:21:20: note: 'x' is uninhabited, so this function body can never be executed | |
func g(_ x: Empty) { | |
^ | |
a.swift:17:11: warning: will never be executed | |
y.f() | |
^ | |
a.swift:17:9: note: a call to a never-returning function | |
y.f() | |
^ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment