func f(flip: Bool) -> (some P)? { // error: `some P` is not the entire return type ... }
type ::= opaque-type opaque-type ::= 'some' type
The type following the 'some' keyword is semantically restricted to be a class or existential type, meaning it must consist only of Any, AnyObject, protocols, or base classes, possibly composed using &.() -> some (P?)
も () -> (some P)?
も使えなくて困らないんだろうか?Collection
の.first
とか使えないと思ったが、.first
は .first: Element?
だから、ここは some
のユースケースじゃないので大丈夫なんだけど・・・。