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
// The problem here is that the call has a contextual result type incompatible
129
129
// with *all* overload set candidates. This is not an ambiguity.
130
-
func overloaded_identity(_ a :Int)->Int{} // expected-note {{found this candidate}}
131
-
func overloaded_identity(_ b :Float)->Float{} // expected-note {{found this candidate}}
130
+
func overloaded_identity(_ a :Int)->Int{} // expected-note {{'overloaded_identity' produces 'Int', not the expected contextual result type '()'}} expected-note {{'overloaded_identity' declared her}}
131
+
func overloaded_identity(_ b :Float)->Float{} // expected-note {{'overloaded_identity' produces 'Float', not the expected contextual result type '()'}}
132
132
133
133
func test_contextual_result_1(){
134
-
returnoverloaded_identity() // expected-error {{no exact matches in call to global function 'overloaded_identity'}}
134
+
returnoverloaded_identity() // expected-error {{missing argument for parameter #1 in call}}
135
+
// expected-error@-1 {{no 'overloaded_identity' candidates produce the expected contextual result type '()'}}
Copy file name to clipboardExpand all lines: test/Parse/recovery.swift
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,12 +10,14 @@ func garbage() -> () {
10
10
vara:Int
11
11
) this line is invalid, but we will stop at the keyword below... // expected-error{{expected expression}}
12
12
return a +"a" // expected-error{{binary operator '+' cannot be applied to operands of type 'Int' and 'String'}} expected-note {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (String, String)}}
13
+
// expected-error@-1 {{no '+' candidates produce the expected contextual result type '()'}}
13
14
}
14
15
15
16
func moreGarbage()->(){
16
17
) this line is invalid, but we will stop at the declaration... // expected-error{{expected expression}}
17
18
func a()->Int{return4}
18
19
returna()+"a" // expected-error{{binary operator '+' cannot be applied to operands of type 'Int' and 'String'}} expected-note {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (String, String)}}
20
+
// expected-error@-1 {{no '+' candidates produce the expected contextual result type '()'}}
0 commit comments