[swift-dev] FixKind::ForceOptional

Daniel Duan daniel at duan.org
Fri Feb 26 17:54:11 CST 2016


Currently, when accessing a property of an optional value without unwrapping,
the compiler issues a fixit message that adds a "!". This seems very
unintuitive as force unwrapping is usually unsafe.

I also recall that "?" was issued in the past.

Is there a particular reason for not to suggest "?" instead? E.g. doing so
will result in semantically incorrect expressions in certain scenario? If not,
I'd love to contribute a patch that brings "?" fixit back.




More information about the swift-dev mailing list