> On May 23, 2016, at 12:12 PM, Charlie Monroe via swift-evolution > <swift-evolution@swift.org> wrote: > >> If the URL path property was defined not to return ‘String?' but to return >> ‘Any’ (which can of course hold an Optional just like it can hold any other >> type) what would the proposed compiler behavior be? > > No warning. Since you cast Optional to Any, no warning can even be issued > since that will eventually be determined during runtime, there's not much the > compiler can do here.
I agree. It is important for optionals to be string literal convertible in generic situations as well as when boxed in an existential like Any. That said, emitting a warning when the compiler knows statically that it has an optional makes a lot of sense. -Chris _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution