This generalization enables curried functions with generic parameters coming from the initial declaration to be printed with the archetype's upperbound rather than '_' unresolved type.
As an added benefit, T.self and T.Type for generic parameters now get shown as the upperbound of the generic parameter provided
We allow the unqualifed use of the enclosing nominal type in a where
clause, but only when it isn't a nested type, e.g:
```
struct S<T> {
typealias T = T
struct R<U> {
typealias U = U
}
}
extension S where S.T == Int {} // allowed
extension S.R where R.U == Int {} // not allowed
```
Tweak the completion logic such that we don't suggest the type for
the nested case, instead it must be qualified.
Requirement lowering only expects that it won't see two requirements
of the same kind (except for conformance requirements). So only mark
those as conflicting.
This addresses a crash-on-invalid and improves diagnostics for
move-only generics, because a conflict won't drop the copyability
of a generic parameter and expose a move-only-naive user to
confusing error messages.
Fixes#61031.
Fixes#63997.
Fixes rdar://problem/111991454.
If the first type has a code completion token, don't record a same type constraint because otherwise if we have
```swift
K.#^COMPLETE^# == Foo
```
we parse this as
```
K == Foo
```
and thus simplify `K` to `Foo`. But we didn't want to state that `K` is `Foo` but that `K` has a member of type `Foo`.
rdar://77458518
The logic here had diverged from UnqualifiedLookup. One day we'll merge
the two, for now clean it up a bit to match.
Note that all generic parameters now have 'Reason' reported as 'Local'.
I don't believe this really matters.
Fixes <rdar://problem/20530021>.
Semantically, these are not superclass/refined-protocol members.
If I have a generic parameter <T : P & Q>, then when looking at
a value of type T, members of P and Q are at the same "level" as
if I had a value of type (P & Q).
We actually want to not use types at all here and instead refactor
this code to use the various decl-level requests instead... but for
now lets be consistent between typo corrections inside function
and type context.
This gets us to the point where we will complete 'T' here:
associatedtype T where #^A^#
And when completing here, we now at least find the correct declaration:
associatedtype T: P where T.#^A^#
There is a remaining issue that in the second example we will not find
members of `P`; we seem to be missing the conformance from the archetype
we get for `T`.
rdar://problem/20582394
Complete generic parameters and their members inside generic where
clauses on structs, classes, enums, extensions, typealiases, funcs,
subscripts and inits.
Still not handled correctly are associatedtypes.
rdar://problem/20582394