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
Copy file name to clipboardExpand all lines: test/Misc/misc_diagnostics.swift
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -54,8 +54,9 @@ struct MyArray<Element> {} // expected-note {{'Element' declared as parameter to
54
54
classA{
55
55
vara:MyArray<Int>
56
56
init(){
57
-
a = MyArray<Int // expected-error {{generic parameter 'Element' could not be inferred}}
58
-
// expected-note@-1 {{explicitly specify the generic arguments to fix this issue}}
57
+
a = MyArray<Int // expected-error {{generic parameter 'Element' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}}
58
+
// expected-error@-1 {{binary operator '<' cannot be applied to operands of type 'MyArray<_>.Type' and 'Int.Type'}}
59
+
// expected-error@-2 {{cannot assign value of type 'Bool' to type 'MyArray<Int>'}}
// expected-error@-1 {{cannot convert value of type 'E_32431165' to expected argument type 'String'}} {{34-34=.rawValue}}
137
137
138
-
E_32431165.bar =="bar"
139
-
// expected-error@-1 {{cannot convert value of type 'E_32431165' to expected argument type 'String}} {{15-15=.rawValue}}
140
-
141
-
"bar"==E_32431165.bar
142
-
// expected-error@-1 {{cannot convert value of type 'E_32431165' to expected argument type 'String}} {{24-24=.rawValue}}
138
+
// TODO: In following two examples it's possible to fix a problem by either using `.rawValue` on first argument
139
+
// or constructing raw representable type from second, both ways are valid.
140
+
do{
141
+
E_32431165.bar =="bar"
142
+
// expected-error@-1 {{binary operator '==' cannot be applied to operands of type 'E_32431165' and 'String'}} expected-note@-1 {{partially matching parameter lists: (String, String)}}
143
+
144
+
"bar"==E_32431165.bar
145
+
// expected-error@-1 {{binary operator '==' cannot be applied to operands of type 'String' and 'E_32431165'}} expected-note@-1 {{partially matching parameter lists: (String, String)}}
146
+
}
143
147
144
-
func rdar32431165_overloaded()->Int{42} // expected-note {{found candidate with type 'Int'}}
148
+
func rdar32431165_overloaded()->Int{42} // expected-note {{'rdar32431165_overloaded()' produces 'Int', not the expected contextual result type 'E_32431165'}}
145
149
func rdar32431165_overloaded()->String{"A"} // expected-note {{'rdar32431165_overloaded()' produces 'String', not the expected contextual result type 'E_32431165'}}
146
150
147
151
func test_candidate_diagnostic(){
148
152
func test_argument(_:E_32431165){}
149
153
150
-
let _:E_32431165=rdar32431165_overloaded() // expected-error {{no exact matches in call to global function 'rdar32431165_overloaded'}}
154
+
let _:E_32431165=rdar32431165_overloaded() // expected-error {{no 'rdar32431165_overloaded' candidates produce the expected contextual result type 'E_32431165'}}
151
155
test_argument(rdar32431165_overloaded()) // expected-error {{cannot convert value of type 'String' to expected argument type 'E_32431165'}} {{17-17=E_32431165(rawValue: }} {{42-42=) ?? <#default value#>}}
0 commit comments