@@ -106,15 +106,18 @@ extension B: @retroactive main::Equatable {
106
106
_ = ( fn, magnitude)
107
107
108
108
if main: : Bool. main : : rando m( ) {
109
- // FIXME improve: expected-error@-1 {{cannot find 'main::Bool' in scope}}
109
+ // expected-error@-1 {{declaration 'Bool' is not imported through module 'main'}}
110
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{8-12=Swift}}
110
111
111
112
main: : negate( )
112
- // FIXME improve: expected-error@-1 {{cannot find 'main::negate' in scope}}
113
+ // expected-error@-1 {{declaration 'negate' is not imported through module 'main'}}
114
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{7-11=self.ModuleSelectorTestingKit}}
113
115
}
114
116
else {
115
117
self = main: : B( value: . main: : min)
116
- // FIXME improve: expected-error@-1 {{cannot find 'main::B' in scope}}
117
- // expected-error@-2 {{cannot infer contextual base in reference to member 'main::min'}}
118
+ // expected-error@-1 {{declaration 'B' is not imported through module 'main'}}
119
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{14-18=ModuleSelectorTestingKit}}
120
+ // expected-error@-3 {{cannot infer contextual base in reference to member 'main::min'}}
118
121
119
122
self = B. main: : init( value: . min)
120
123
// FIXME improve: expected-error@-1 {{'B' cannot be constructed because it has no accessible initializers}}
@@ -124,7 +127,8 @@ extension B: @retroactive main::Equatable {
124
127
self . main : : myNegate( )
125
128
126
129
main: : fatalError( )
127
- // FIXME improve: expected-error@-1 {{cannot find 'main::fatalError' in scope}}
130
+ // expected-error@-1 {{declaration 'fatalError' is not imported through module 'main'}}
131
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{5-9=Swift}}
128
132
}
129
133
130
134
// FIXME: Can we test @convention(witness_method:)?
@@ -172,10 +176,12 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
172
176
_ = ( fn, magnitude)
173
177
174
178
if ModuleSelectorTestingKit : : Bool. ModuleSelectorTestingKit : : rando m( ) {
175
- // FIXME improve: expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::Bool' in scope}}
179
+ // expected-error@-1 {{declaration 'Bool' is not imported through module 'ModuleSelectorTestingKit'}}
180
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{8-32=Swift}}
176
181
177
182
ModuleSelectorTestingKit: : negate( )
178
- // expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::negate' in scope}}
183
+ // expected-error@-1 {{declaration 'negate' is not imported through module 'ModuleSelectorTestingKit'}}
184
+ // expected-note@-2 {{did you mean the member of 'self'?}} {{7-7=self.}}
179
185
}
180
186
else {
181
187
self = ModuleSelectorTestingKit : : C( value: . ModuleSelectorTestingKit: : min)
@@ -188,7 +194,8 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
188
194
// FIXME improve: expected-error@-1 {{value of type 'C' has no member 'ModuleSelectorTestingKit::myNegate'}}
189
195
190
196
ModuleSelectorTestingKit: : fatalError( )
191
- // FIXME improve: expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::fatalError' in scope}}
197
+ // expected-error@-1 {{declaration 'fatalError' is not imported through module 'ModuleSelectorTestingKit'}}
198
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{5-29=Swift}}
192
199
}
193
200
194
201
// FIXME: Can we test @convention(witness_method:)?
@@ -218,24 +225,28 @@ extension D: @retroactive Swift::Equatable {
218
225
// FIXME improve: expected-error@-1 {{replaced function 'Swift::negate()' could not be found}}
219
226
220
227
mutating func myNegate( ) {
228
+ // expected-note@-1 {{did you mean 'myNegate'?}}
221
229
222
230
let fn : ( Swift: : Int , Swift : : Int ) -> Swift : : Int =
223
231
( Swift: : + )
224
232
225
233
let magnitude : Int . Swift : : Magnitude = Swift: : magnitude
226
- // expected-error@-1 {{cannot find 'Swift::magnitude' in scope}}
234
+ // expected-error@-1 {{declaration 'magnitude' is not imported through module 'Swift'}}
235
+ // expected-note@-2 {{did you mean module 'main'?}} {{43-48=main}}
227
236
228
237
_ = ( fn, magnitude)
229
238
230
239
if Swift : : Bool. Swift : : rando m( ) {
231
240
232
241
Swift: : negate( )
233
- // FIXME improve: expected-error@-1 {{cannot find 'Swift::negate' in scope}}
242
+ // expected-error@-1 {{declaration 'negate' is not imported through module 'Swift'}}
243
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{7-12=self.ModuleSelectorTestingKit}}
234
244
}
235
245
else {
236
246
self = Swift: : D( value: . Swift: : min)
237
- // FIXME improve: expected-error@-1 {{cannot find 'Swift::D' in scope}}
238
- // expected-error@-2 {{cannot infer contextual base in reference to member 'Swift::min'}}
247
+ // expected-error@-1 {{declaration 'D' is not imported through module 'Swift'}}
248
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{14-19=ModuleSelectorTestingKit}}
249
+ // expected-error@-3 {{cannot infer contextual base in reference to member 'Swift::min'}}
239
250
240
251
self = D. Swift: : init( value: . min)
241
252
// FIXME improve: expected-error@-1 {{'D' cannot be constructed because it has no accessible initializers}}
@@ -255,7 +266,8 @@ let mog: Never = fatalError()
255
266
256
267
func localVarsCantBeAccessedByModuleSelector( ) {
257
268
let mag : Int . Swift : : Magnitude = main: : mag
258
- // expected-error@-1 {{cannot find 'main::mag' in scope}}
269
+ // expected-error@-1 {{declaration 'mag' is not imported through module 'main'}}
270
+ // expected-note@-2 {{did you mean the local declaration?}} {{35-41=}}
259
271
260
272
let mog : Never = main: : mog
261
273
}
@@ -291,26 +303,27 @@ func decl1(
291
303
// expected-error@-1 {{type 'A' is not imported through module 'main'}}
292
304
// expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{7-11=ModuleSelectorTestingKit}}
293
305
label p2 : inout A,
306
+ // From uses in the switch statements below: expected-note@-1 3 {{did you mean the local declaration?}}
294
307
label p3 : @escaping ( ) - > A
295
308
) {
296
309
switch Optional ( main: : p2) {
297
- // expected-error@-1 {{cannot find 'main:: p2' in scope }}
310
+ // expected-error@-1 {{declaration ' p2' is not imported through module 'main' }}
298
311
case Optional . some( let decl1i) :
299
312
break
300
313
case . none:
301
314
break
302
315
}
303
316
304
317
switch Optional ( main: : p2) {
305
- // expected-error@-1 {{cannot find 'main:: p2' in scope }}
318
+ // expected-error@-1 {{declaration ' p2' is not imported through module 'main' }}
306
319
case let Optional . some( decl1j) :
307
320
break
308
321
case . none:
309
322
break
310
323
}
311
324
312
325
switch Optional ( main: : p2) {
313
- // expected-error@-1 {{cannot find 'main:: p2' in scope }}
326
+ // expected-error@-1 {{declaration ' p2' is not imported through module 'main' }}
314
327
case let decl1k? :
315
328
break
316
329
case . none:
@@ -324,7 +337,9 @@ typealias decl5 = main::Bool
324
337
325
338
func badModuleNames( ) {
326
339
NonexistentModule: : print( )
327
- // expected-error@-1 {{cannot find 'NonexistentModule::print' in scope}}
340
+ // expected-error@-1 {{declaration 'print' is not imported through module 'NonexistentModule'}}
341
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{3-20=Swift}}
342
+ // FIXME redundant: expected-note@-3 {{did you mean module 'Swift'?}}
328
343
329
344
_ = " foo " . NonexistentModule: : count
330
345
// FIXME improve: expected-error@-1 {{value of type 'String' has no member 'NonexistentModule::count'}}
0 commit comments