[swift-evolution] [Pitch] Nil struct

Karl razielim at gmail.com
Wed Nov 9 10:09:24 CST 2016

> On 9 Nov 2016, at 16:55, Karl <raziel.im+swift-evo at gmail.com> wrote:
> If the compiler can’t infer T (such as “let a = nil”), it should fall-back to Optional<Any>.none; I’m very surprised that this isn’t the case currently.

Oh, it is the case currently:

let a = nil
error: repl.swift:1:9: error: 'nil' requires a contextual type

I’m not familiar with why the compiler needs _OptionalNilComparisonType in order to compare to “nil”, but I would guess it could be improved to recognise the literal natively if removing this protocol is a significant concern.

- Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161109/73681eb6/attachment.html>

More information about the swift-evolution mailing list