Partial type annotations

_ is Swift's wildcard pattern, so it's the most appropriate one in this regard:

If existentials types will require the any keyword as described in Improving the UI of generics (although it refers only to protocol existential types and not generic existential types), there won't be ambiguities for generic existentials, right?

let d: [_: Int] = ["one": 1, "two": 2]
// inferred type Dictionary<String, Int>

var e: any [_: Int] = ["one": 1, "two": 2]
// inferred type existential type of all dictionaries
// having Int values
e = [3: 3, 4: 4]

// opaque types too?
var o: some [_: Int] = ["one": 1, "two": 2]
// hidden type, you cannot interact with 'o' unless casted
o = ["three": 3, "four": 4]  // {error}:
// Cannot assign value of type 'Dictionary<String, Int>'
// to type 'some Dictionary<_, Int>'
3 Likes