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
Move CallExpr diagnostics over to the same overload candidate diagnosis
facilities used by operators etc. This required a bunch of changes to make
the diagnostics changes strictly an improvement:
- Teach the new path about calls to TypeExprs.
- Teach evaluateCloseness some simple things about varargs.
- Make the generic diagnosis logic produce a better error when there is
exactly one match.
Overall, the resultant diagnostics are a step forward: we now produce candidate
set notes more uniformly, and the messages about some existing ones are
more specific. This is just another stepping stone towards progress though.
Swift SVN r30057
letc1= us + i // expected-error {{binary operator '+' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '+' exist with these partially matching parameter lists:}}
18
18
letc2= us - i // expected-error {{binary operator '-' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '-' exist with these partially matching parameter lists:}}
19
-
letc3= us * i // expected-error {{binary operator '*' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '*' exist with these partially matching parameter lists:}}
20
-
letc4= us / i // expected-error {{binary operator '/' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '/' exist with these partially matching parameter lists:}}
19
+
letc3= us * i // expected-error {{binary operator '*' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{expected an argument list of type '(Int, Int)'}}
20
+
letc4= us / i // expected-error {{binary operator '/' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{expected an argument list of type '(Int, Int)'}}
21
21
22
22
letd1= i + us // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{overloads for '+' exist with these partially matching parameter lists:}}
23
-
letd2= i - us // expected-error {{binary operator '-' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{overloads for '-' exist with these partially matching parameter lists:}}
24
-
letd3= i * us // expected-error {{binary operator '*' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{overloads for '*' exist with these partially matching parameter lists:}}
25
-
letd4= i / us // expected-error {{binary operator '/' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{overloads for '/' exist with these partially matching parameter lists:}}
23
+
letd2= i - us // expected-error {{binary operator '-' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{expected an argument list of type '(Int, Int)'}}
24
+
letd3= i * us // expected-error {{binary operator '*' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{expected an argument list of type '(Int, Int)'}}
25
+
letd4= i / us // expected-error {{binary operator '/' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{expected an argument list of type '(Int, Int)'}}
leta=NSObjectFactorySub(buildingWidgets:()) // expected-error{{cannot find an initializer for type 'NSObjectFactorySub' that accepts an argument list of type '(buildingWidgets: ())'}}
23
+
// expected-note @-1 {{overloads for 'NSObjectFactorySub' exist with these partially matching parameter lists: (integer: Int), (double: Double), ()}}
acceptsInt(obj.nonVoidReturn) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '(() -> Int32)'}}
21
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
22
+
21
23
acceptsInt(obj.nonMatchingType) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '(() -> Int32)'}}
24
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
25
+
22
26
acceptsInt(obj.wrongGetterArgs) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '((Int32) -> Int32)'}}
27
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
28
+
23
29
acceptsInt(obj.wrongSetterArgs) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '(() -> Int32)'}}
30
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
31
+
24
32
acceptsInt(obj.wrongSetterArgs2) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '(() -> Int32)'}}
33
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
34
+
25
35
acceptsInt(obj.getterOnly) // expected-error {{cannot find an overload for 'acceptsInt' that accepts an argument list of type '(() -> Int32)'}}
36
+
// expected-note @-1 {{overloads for 'acceptsInt' exist with these partially matching parameter lists: (Int), (UInt)}}
37
+
26
38
acceptsInt(obj.setterOnly) // expected-error {{'BadImplicitProperties' does not have a member named 'setterOnly'}}
27
39
28
40
// But we should still import all of the methods as methods.
leta=NSObjectFactorySub(buildingWidgets:()) // expected-error{{cannot find an initializer for type 'NSObjectFactorySub' that accepts an argument list of type '(buildingWidgets: ())'}}
39
+
// expected-note @-1 {{overloads for 'NSObjectFactorySub' exist with these partially matching parameter lists: (integer: Int), (double: Double), ()}}
B.instanceTakesObjectClassTakesFloat(other) // expected-error{{cannot invoke 'instanceTakesObjectClassTakesFloat' with an argument list of type '(NSObject)'}}
74
+
// expected-note @-1 {{expected an argument list of type '(Float)'}}
0 commit comments