File tree Expand file tree Collapse file tree 4 files changed +14
-15
lines changed Expand file tree Collapse file tree 4 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -3009,13 +3009,14 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
3009
3009
}
3010
3010
}
3011
3011
3012
+ // If any of the non-overloaded common fixes appear in all solutions
3013
+ // and can be diagnosed by the diagnoseForAmbiguity implementation,
3014
+ // we diagnose and be done.
3012
3015
if (diagnosed)
3013
3016
return true ;
3014
3017
3015
- // If all non-overloaded common fixes do not appear in all solutions
3016
- // nor are diagnosed for ambiguity, let's try to fall back to common
3017
- // anchor diagnostic.
3018
-
3018
+ // Otherwise let's try to fall back to overload common anchor
3019
+ // diagnostic if possible.
3019
3020
if (ambiguosOverloads.empty ())
3020
3021
return false ;
3021
3022
Original file line number Diff line number Diff line change @@ -496,10 +496,8 @@ enum Color {
496
496
497
497
static func rainbow( ) -> Color { }
498
498
499
- static func overload( a : Int ) -> Color { } // expected-note {{incorrect labels for candidate (have: '(_:)', expected: '(a:)')}}
500
- // expected-note@-1 {{candidate has partially matching parameter list (a: Int)}}
501
- static func overload( b : Int ) -> Color { } // expected-note {{incorrect labels for candidate (have: '(_:)', expected: '(b:)')}}
502
- // expected-note@-1 {{candidate has partially matching parameter list (b: Int)}}
499
+ static func overload( a : Int ) -> Color { } // expected-note 2 {{incorrect labels for candidate (have: '(_:)', expected: '(a:)')}}
500
+ static func overload( b : Int ) -> Color { } // expected-note 2 {{incorrect labels for candidate (have: '(_:)', expected: '(b:)')}}
503
501
504
502
static func frob( _ a : Int , b : inout Int ) -> Color { }
505
503
static var svar : Color { return . Red }
Original file line number Diff line number Diff line change @@ -39,15 +39,15 @@ class B {
39
39
init ( ) {
40
40
}
41
41
42
- init ( x: Int ) { // expected-note{{candidate has partially matching parameter list (x: Int )}}
42
+ init ( x: Int ) { // expected-note{{incorrect labels for candidate (have: '(_:)', expected: ' (x:)' )}}
43
43
}
44
44
45
- init ( a: UnicodeScalar ) { // expected-note {{candidate has partially matching parameter list (a: UnicodeScalar )}}
45
+ init ( a: UnicodeScalar ) { // expected-note {{incorrect labels for candidate (have: '(_:)', expected: ' (a:)' )}}
46
46
}
47
- init ( b: UnicodeScalar ) { // expected-note{{candidate has partially matching parameter list (b: UnicodeScalar )}}
47
+ init ( b: UnicodeScalar ) { // expected-note{{incorrect labels for candidate (have: '(_:)', expected: ' (b:)' )}}
48
48
}
49
49
50
- init ( z: Float ) { // expected-note{{candidate has partially matching parameter list (z: Float )}}
50
+ init ( z: Float ) { // expected-note {{incorrect labels for candidate (have: '(_:)', expected: ' (z:)' )}}
51
51
super. init ( ) // expected-error{{'super' members cannot be referenced in a root class}}
52
52
}
53
53
}
Original file line number Diff line number Diff line change @@ -323,12 +323,12 @@ class TestOverloadSets {
323
323
self . init ( 5 , 5 ) // expected-error{{extra argument in call}}
324
324
}
325
325
326
- convenience init ( a : Z0 ) { // expected-note{{candidate has partially matching parameter list (a: Z0 )}}
326
+ convenience init ( a : Z0 ) { // expected-note{{incorrect labels for candidate (have: '(_:)', expected: ' (a:)' )}}
327
327
self . init ( 42 as Int8 ) // expected-error{{no exact matches in call to initializer}}
328
328
}
329
329
330
- init ( value: Int ) { /* ... */ } // expected-note{{candidate has partially matching parameter list (value: Int )}}
331
- init ( value: Double ) { /* ... */ } // expected-note{{candidate has partially matching parameter list (value: Double )}}
330
+ init ( value: Int ) { /* ... */ } // expected-note{{incorrect labels for candidate (have: '(_:)', expected: ' (value:)' )}}
331
+ init ( value: Double ) { /* ... */ } // expected-note{{incorrect labels for candidate (have: '(_:)', expected: ' (value:)' )}}
332
332
}
333
333
334
334
class TestNestedExpr {
You can’t perform that action at this time.
0 commit comments