You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Type checker] Use call argument matching even with type variables on the left-hand side.
Rather than using a specialized matching rule in the type checker that depends on having default arguments in types, use call argument matching consistently. Note #1: This (correctly) breaks some existing code that depends on inferring a parameter type of () for a single-argument parameter from a no-argument function type(). Note #2: This pessimizes a code completion test, where the code completion engine seems to depend on some quirks of argument matching. The "type relationship" matching needs non-trivial work.
f2 = f1 // expected-error{{cannot assign value of type '(fp: FormattedPrintable) -> CustomStringConvertible' to type '(p: CustomStringConvertible) -> FormattedPrintable'}}
35
35
36
36
accept_creates_Printable(ac1)
37
-
accept_creates_Printable({ac2($0)})
38
-
accept_creates_Printable({ip1($0)})
37
+
accept_creates_Printable({ac2()})
38
+
accept_creates_Printable({ip1()})
39
39
accept_creates_FormattedPrintable(ac1) // expected-error{{cannot convert value of type '@autoclosure () -> CustomStringConvertible' to expected argument type '@noescape () -> FormattedPrintable'}}
40
40
accept_creates_FormattedPrintable(ac2)
41
41
accept_creates_FormattedPrintable(ip1) // expected-error{{cannot convert value of type '@autoclosure () -> IsPrintable1' to expected argument type '@noescape () -> FormattedPrintable'}}
0 commit comments