@@ -89,27 +89,24 @@ somekeywords1(x: 1, y: 2, z: 3) // expected-error{{extraneous argument label 'x:
8989somekeywords1 ( 1 , 2 , 3 ) // expected-error{{missing argument labels 'y:z:' in call}}{{18-18=y: }}{{21-21=z: }}
9090somekeywords1 ( x: 1 , 2 , z: 3 ) // expected-error{{incorrect argument labels in call (have 'x:_:z:', expected '_:y:z:')}}{{15-18=}}{{21-21=y: }}
9191
92- // SR-2242: poor diagnostic when argument label is omitted
93-
94- func r27212391( x: Int , _ y: Int ) {
95- let _: Int = x + y
96- }
97-
98- func r27212391( a: Int , x: Int , _ y: Int ) {
99- let _: Int = a + x + y
92+ // https://github.com/apple/swift/issues/44849
93+ // Poor diagnostic when argument label is omitted
94+ do {
95+ func f( x: Int , _ y: Int ) { }
96+ func f( a: Int , x: Int , _ y: Int ) { }
97+
98+ f ( 3 , 5 ) // expected-error {{missing argument label 'x:' in call}}
99+ f ( 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have '_:y:', expected 'x:_:')}}
100+ f ( 3 , x: 5 ) // expected-error {{argument 'x' must precede unnamed argument #1}} {{5-5=x: 5, }} {{6-12=}}
101+ f ( y: 3 , x: 5 ) // expected-error {{incorrect argument labels in call (have 'y:x:', expected 'x:_:')}} {{5-6=x}} {{11-14=}}
102+ f ( y: 3 , 5 ) // expected-error {{incorrect argument label in call (have 'y:_:', expected 'x:_:')}}
103+ f ( x: 3 , x: 5 ) // expected-error {{extraneous argument label 'x:' in call}}
104+ f ( a: 1 , 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have 'a:_:y:', expected 'a:x:_:')}}
105+ f ( 1 , x: 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have '_:x:y:', expected 'a:x:_:')}}
106+ f ( a: 1 , y: 3 , x: 5 ) // expected-error {{incorrect argument labels in call (have 'a:y:x:', expected 'a:x:_:')}}
107+ f ( a: 1 , 3 , x: 5 ) // expected-error {{argument 'x' must precede unnamed argument #2}} {{11-11=x: 5, }} {{12-18=}}
100108}
101109
102- r27212391 ( 3 , 5 ) // expected-error {{missing argument label 'x:' in call}}
103- r27212391 ( 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have '_:y:', expected 'x:_:')}}
104- r27212391 ( 3 , x: 5 ) // expected-error {{argument 'x' must precede unnamed argument #1}} {{11-11=x: 5, }} {{12-18=}}
105- r27212391 ( y: 3 , x: 5 ) // expected-error {{incorrect argument labels in call (have 'y:x:', expected 'x:_:')}} {{11-12=x}} {{17-20=}}
106- r27212391 ( y: 3 , 5 ) // expected-error {{incorrect argument label in call (have 'y:_:', expected 'x:_:')}}
107- r27212391 ( x: 3 , x: 5 ) // expected-error {{extraneous argument label 'x:' in call}}
108- r27212391 ( a: 1 , 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have 'a:_:y:', expected 'a:x:_:')}}
109- r27212391 ( 1 , x: 3 , y: 5 ) // expected-error {{incorrect argument labels in call (have '_:x:y:', expected 'a:x:_:')}}
110- r27212391 ( a: 1 , y: 3 , x: 5 ) // expected-error {{incorrect argument labels in call (have 'a:y:x:', expected 'a:x:_:')}}
111- r27212391 ( a: 1 , 3 , x: 5 ) // expected-error {{argument 'x' must precede unnamed argument #2}} {{17-17=x: 5, }} {{18-24=}}
112-
113110// -------------------------------------------
114111// Out-of-order keywords
115112// -------------------------------------------
@@ -1718,8 +1715,10 @@ struct DiagnoseAllLabels {
17181715 }
17191716}
17201717
1721- // SR-13135: Type inference regression in Swift 5.3 - can't infer a type of @autoclosure result.
1722- func sr13135( ) {
1718+ /// https://github.com/apple/swift/issues/55581
1719+ /// Type inference regression in Swift 5.3 - can't infer a type of
1720+ /// `@autoclosure` result
1721+ do {
17231722 struct Foo {
17241723 var bar : [ Int ] = [ ]
17251724 }
@@ -1734,12 +1733,13 @@ func sr13135() {
17341733 foo ( Foo ( ) . bar, [ baz] )
17351734}
17361735
1737- // SR-13240
1738- func twoargs( _ x: String , _ y: String ) { }
1736+ // https://github.com/apple/swift/issues/55681
1737+ do {
1738+ func twoargs( _ x: String , _ y: String ) { }
17391739
1740- func test( ) {
17411740 let x = 1
1742- twoargs ( x, x) // expected-error 2 {{cannot convert value of type 'Int' to expected argument type 'String'}}
1741+ twoargs ( x, x)
1742+ // expected-error@-1 2 {{cannot convert value of type 'Int' to expected argument type 'String'}}
17431743}
17441744
17451745infix operator ---
0 commit comments