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
return[Count()] // expected-error {{missing argument for parameter 'title' in call}}
125
130
}, completedBy:{ // expected-error {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{20-20= _ in}}
126
131
})
127
132
}
128
133
129
-
// SR-12689
130
-
func SR12689(_ u:UnsafeBufferPointer<UInt16>){}
134
+
// https://github.com/apple/swift/issues/55133
135
+
do{
136
+
func f(_ u:UnsafeBufferPointer<UInt16>){}
131
137
132
-
letarray:[UInt16]=[1,2]
138
+
letarray:[UInt16]
133
139
134
-
array.withUnsafeBufferPointer{
135
-
_ =SR12689(UnsafeRawPointer($0).bindMemory(to:UInt16.self, capacity:1)) // expected-error {{cannot convert value of type 'UnsafePointer<UInt16>' to expected argument type 'UnsafeBufferPointer<UInt16>'}}
136
-
// expected-error@-1 {{cannot convert value of type 'UnsafeBufferPointer<UInt16>' to expected argument type 'UnsafeMutableRawPointer'}}
137
-
}
140
+
array.withUnsafeBufferPointer{
141
+
_ =f(UnsafeRawPointer($0).bindMemory(to:UInt16.self, capacity:1)) // expected-error {{cannot convert value of type 'UnsafePointer<UInt16>' to expected argument type 'UnsafeBufferPointer<UInt16>'}}
142
+
// expected-error@-1 {{cannot convert value of type 'UnsafeBufferPointer<UInt16>' to expected argument type 'UnsafeMutableRawPointer'}}
143
+
}
138
144
139
-
array.withUnsafeBufferPointer{
140
-
_ =UnsafeRawPointer($0)asUnsafeBufferPointer<UInt16> // expected-error {{cannot convert value of type 'UnsafeRawPointer' to type 'UnsafeBufferPointer<UInt16>' in coercion}}
141
-
// expected-error@-1 {{cannot convert value of type 'UnsafeBufferPointer<UInt16>' to expected argument type 'UnsafeMutableRawPointer'}}
145
+
array.withUnsafeBufferPointer{
146
+
_ =UnsafeRawPointer($0)asUnsafeBufferPointer<UInt16> // expected-error {{cannot convert value of type 'UnsafeRawPointer' to type 'UnsafeBufferPointer<UInt16>' in coercion}}
147
+
// expected-error@-1 {{cannot convert value of type 'UnsafeBufferPointer<UInt16>' to expected argument type 'UnsafeMutableRawPointer'}}
148
+
}
142
149
}
150
+
do{
151
+
func f1(_ u:Int)->String{} // expected-note {{found this candidate}} expected-note {{candidate expects value of type 'Int' for parameter #1 (got 'Double')}}
152
+
func f1(_ u:String)->Double{} // expected-note {{found this candidate}} expected-note {{candidate expects value of type 'String' for parameter #1 (got 'Double')}}
153
+
func f2(_ u:Int){}
143
154
144
-
func SR12689_1(_ u:Int)->String{""} // expected-note {{found this candidate}} expected-note {{candidate expects value of type 'Int' for parameter #1 (got 'Double')}}
145
-
func SR12689_1(_ u:String)->Double{0} // expected-note {{found this candidate}} expected-note {{candidate expects value of type 'String' for parameter #1 (got 'Double')}}
146
-
func SR12689_2(_ u:Int){}
147
-
148
-
SR12689_2(SR12689_1(1asDouble)) // expected-error {{no exact matches in call to global function 'SR12689_1'}}
149
-
SR12689_1(1asDouble)asInt // expected-error {{no exact matches in call to global function 'SR12689_1'}}
150
-
151
-
// Ambiguous OverloadRefExpr
152
-
func SR12689_O(_ p:Int){} // expected-note {{found candidate with type '(Int) -> ()'}}
153
-
func SR12689_O(_ p:Double){} // expected-note {{found candidate with type '(Double) -> ()'}}
154
-
func SR12689_3(_ param:(String)->Void){}
155
+
f2(f1(1asDouble)) // expected-error {{no exact matches in call to local function 'f1'}}
156
+
f1(1asDouble)asInt // expected-error {{no exact matches in call to local function 'f1'}}
157
+
}
158
+
do{
159
+
// Ambiguous OverloadRefExpr
160
+
func f1(_ p:Int){} // expected-note {{found candidate with type '(Int) -> ()'}}
161
+
func f1(_ p:Double){} // expected-note {{found candidate with type '(Double) -> ()'}}
162
+
func f2(_ param:(String)->Void){}
155
163
156
-
SR12689_3(SR12689_O) // expected-error {{no 'SR12689_O' candidates produce the expected type '(String) -> Void' for parameter #0}}
164
+
f2(f1) // expected-error {{no 'f1' candidates produce the expected type '(String) -> Void' for parameter #0}}
// expected-error@-1 {{cannot convert value of type 'E_32431165' to expected argument type 'String'}} {{17-17=.rawValue}}
169
169
}
170
170
171
-
func sr8150_helper1(_:Int){}
172
-
func sr8150_helper1(_:Double){}
173
-
174
-
func sr8150_helper2(_:Double){}
175
-
func sr8150_helper2(_:Int){}
176
-
177
-
func sr8150_helper3(_:Foo){}
178
-
func sr8150_helper3(_:Bar){}
179
-
180
-
func sr8150_helper4(_:Bar){}
181
-
func sr8150_helper4(_:Foo){}
182
-
183
-
func sr8150(bar:Bar){
184
-
sr8150_helper1(bar)
185
-
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{21-21=.rawValue}}
186
-
sr8150_helper2(bar)
187
-
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{21-21=.rawValue}}
188
-
sr8150_helper3(0.0)
189
-
// expected-error@-1 {{cannot convert value of type 'Double' to expected argument type 'Bar'}} {{18-18=Bar(rawValue: }} {{21-21=) ?? <#default value#>}}
190
-
sr8150_helper4(0.0)
191
-
// expected-error@-1 {{cannot convert value of type 'Double' to expected argument type 'Bar'}} {{18-18=Bar(rawValue: }} {{21-21=) ?? <#default value#>}}
192
-
}
171
+
// https://github.com/apple/swift/issues/50682
172
+
do{
173
+
func helper1(_:Int){}
174
+
func helper1(_:Double){}
193
175
194
-
classSR8150Box{
195
-
varbar:Bar
196
-
init(bar:Bar){self.bar = bar }
197
-
}
198
-
// Bonus problem with mutable values being passed.
199
-
func sr8150_mutable(obj:SR8150Box){
200
-
sr8150_helper1(obj.bar)
201
-
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{25-25=.rawValue}}
202
-
203
-
varbar= obj.bar
204
-
sr8150_helper1(bar)
205
-
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{21-21=.rawValue}}
206
-
207
-
func test(_ opt:Bar?){
208
-
sr8150_helper1(opt)
209
-
// expected-error@-1 {{cannot convert value of type 'Bar?' to expected argument type 'Double'}} {{23-23=?.rawValue ?? <#default value#>}}
210
-
sr8150_helper1(opt ??Bar.a)
211
-
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{20-20=(}} {{32-32=).rawValue}}
176
+
func helper2(_:Double){}
177
+
func helper2(_:Int){}
178
+
179
+
func helper3(_:Foo){}
180
+
func helper3(_:Bar){}
181
+
182
+
func helper4(_:Bar){}
183
+
func helper4(_:Foo){}
184
+
185
+
do{
186
+
letbar:Bar
187
+
188
+
helper1(bar)
189
+
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{16-16=.rawValue}}
190
+
helper2(bar)
191
+
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{16-16=.rawValue}}
192
+
helper3(0.0)
193
+
// expected-error@-1 {{cannot convert value of type 'Double' to expected argument type 'Bar'}} {{13-13=Bar(rawValue: }} {{16-16=) ?? <#default value#>}}
194
+
helper4(0.0)
195
+
// expected-error@-1 {{cannot convert value of type 'Double' to expected argument type 'Bar'}} {{13-13=Bar(rawValue: }} {{16-16=) ?? <#default value#>}}
196
+
}
197
+
198
+
// Bonus problem with mutable values being passed.
199
+
do{
200
+
classBox{
201
+
varbar:Bar
202
+
init(bar:Bar){}
203
+
}
204
+
205
+
letbox:Box
206
+
207
+
helper1(box.bar)
208
+
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{20-20=.rawValue}}
209
+
210
+
varbar= box.bar
211
+
helper1(bar)
212
+
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{16-16=.rawValue}}
213
+
}
214
+
215
+
do{
216
+
letopt:Bar?
217
+
218
+
helper1(opt)
219
+
// expected-error@-1 {{cannot convert value of type 'Bar?' to expected argument type 'Double'}} {{16-16=?.rawValue ?? <#default value#>}}
220
+
helper1(opt ??Bar.a)
221
+
// expected-error@-1 {{cannot convert value of type 'Bar' to expected argument type 'Double'}} {{13-13=(}} {{25-25=).rawValue}}
212
222
let _:Double?= opt
213
223
// expected-error@-1 {{cannot convert value of type 'Bar?' to specified type 'Double?'}} {{25-25=?.rawValue}}
0 commit comments