SE-0352: Implicitly Opened Existentials

Is there third option?

  1. We could force the caller explicitly write the return type when there is no way to express upper limit, so that when we get way to express the constraint, callers can manually add them.
func foo(value: any P) {
    let a = getA(value)  // error
    let a: any Collection = getA(value)  // ok
    let a: any Collection<.Index == Int> = getA(value) // when we get expression
}
2 Likes