This appears to be a quirk in print
for this compiler, purely conjecture it may be an artefact of work on changing the semantics of implicitly unwrapped optionals, see Abolish ImplicitlyUnwrappedOptional
type.
The type Optional
is, stripping to the basics, defined as:
enum Optional<Wrapped>
{
case none
case some(Wrapped)
}
Normally if you print()
an enum
you do get the literals, here none
and some()
, however print()
normally prints optionals as nil
and Optional()
.
It seems in Xcode 9.4.1 (at least) implicitly unwrapped optionals are being printed as optionals but without the special casing, whereas Xcode 9.2 (at least) prints the unwrapped value as would be expected (because it is implicitly unwrapped).
Maybe there is other interesting behaviour for implicitly unwrapped optionals in 9.4.1. You should test in Xcode 10 Beta and/or report a bug (bugreport.apple.com) in 9.4.1 and see what Apple say.