Weird Swift type inference limitation: I'd assumed that @discardableResult was j...
Nick Lockwood @nicklockwood@mastodon.social
Weird Swift type inference limitation: I'd assumed that @discardableResult was just a convenience so you don't have to write functions twice, but no. It turns out that Swift can't disambiguate between a function that returns Void and one that returns something else if you put them in a statement position - even though calling the latter would be invalid and raise an unused value warning ??
func foo() {}
func foo() -> Int { 5 }
foo() // raises ambiguity warning