The check was disabled because of a typo, but was also duplicating a
check two lines above anyway, so remove it.
Credit to David Ungar for spotting it!
There were 2 functions to output argument list. Consolidate them and
consistently use it from every call like production (i.e. function call,
constructor call, enum with associated values, subscript)
Before checking type relation between candidate types and expected
types. In normal compilation, this removal is done in CSGen. However,
since code-completion directly uses Constraint System, we have to
manually remove argument labels before checking convertibility.
We can remove argument labels unconditionally because function types as
as value cannot have argument labels. (i.e. `let f: (a: Int) -> Int` is
illegal). That means, expected types shouldn't have any argument labels.
This fixes regression revealed in 5e75b1ad3b
rdar://problem/41496748
This either became dead shortly after the removal of Swift 3
compatibility mode from the constraint solver, or even earlier.
Note that the code completion test change is actually correct
because (Any) -> () is not convertible to () -> () in the
language.
These are all tests that would otherwise fail if the expression type
checker support for Swift 3 is removed.
I've moved some of the code from deleted Migrator tests into new
Constraints tests that verify that we do not support the constructs.
The underlying type-check was correct, but I forgot to consider it in
the outer code, and embarassingly never tested this case.
rdar://problem/28435922
We strip the first input type on instance methods like,
struct S { func foo(T) -> U } // (S)->(T)->U
but we should not do that when it's actually a curried instance method,
such as S.foo.
If we're completing in a context that expects a function type, try to
match methods/functions as function references before trying them as
calls. This means that
func take(_: (Int)->()) {}
func foo(a: Int) {}
take(#^A^#) // completes foo(a:) instead of foo(a: {#value#})
Note: doesn't yet work with generic types.
rdar://problem/28435922