func coll() -> some MutableCollection { ... } var a = coll() a[a.startIndex] = 1 // だめ。aのElementがIntかどうかはわからない a.forEach { (x) in // OK。x: Elementがなんでもいいので print(x) }x に対して型を書く記法が無いっすね。func coll() -> some MutableCollection { ... } var a = coll() a[a.startIndex] = 1 // だめ。aのElementがIntかどうかはわからない a.forEach { (x: #type(of: a).Element) in // OK。x: Elementがなんでもいいので print(x) } ↑無理やり考えるならこうか (edited)#_returnType(of: coll) って実在してたっけ。