@@ -15,36 +15,59 @@ let magnitude: Never = fatalError()
15
15
// Test resolution of main:: using `B`
16
16
17
17
extension main : : B { }
18
- // FIXME improve: expected-error@-1 {{use of undeclared type 'main::B'}}
18
+ // expected-error@-1 {{type 'B' is not imported through module 'main'}}
19
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{11-15=ModuleSelectorTestingKit}}
19
20
20
21
extension B : main : : Equatable {
22
+ // expected-error@-1 {{type 'Equatable' is not imported through module 'main'}}
23
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{14-18=Swift}}
24
+
21
25
@_implements ( main: : Equatable, main: : == ( _: _: ) )
22
26
// expected-error@-1 {{name cannot be qualified with module selector here}} {{33-39=}}
23
- public static func equals( _: main : : B, _: main : : B) -> main : : Bool { main: : fatalError( ) }
24
-
27
+ // expected-error@-2 {{type 'Equatable' is not imported through module 'main'}}
28
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{16-20=Swift}}
29
+ public static func equals( _: main : : B, _: main : : B) -> main : : Bool {
30
+ // expected-error@-1 2{{type 'B' is not imported through module 'main'}}
31
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{32-36=ModuleSelectorTestingKit}}
32
+ // expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{44-48=ModuleSelectorTestingKit}}
33
+ // expected-error@-4 {{type 'Bool' is not imported through module 'main'}}
34
+ // expected-note@-5 {{did you mean module 'Swift'?}} {{56-60=Swift}}
35
+ main: : fatalError( )
36
+ // expected-EVENTUALLY-error@-1 {{type 'fatalError' is not imported through module 'main'}}
37
+ // expected-EVENTUALLY-note@-2 {{did you mean module 'Swift'?}} {{4-8=Swift}}
38
+ }
39
+
25
40
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
26
41
// @_derivative(of:)
27
42
28
43
@_dynamicReplacement ( for: main: : negate( ) )
29
44
// FIXME improve: expected-error@-1 {{replaced function 'main::negate()' could not be found}}
30
45
mutating func myNegate( ) {
31
46
let fn : ( main: : Int , main : : Int ) -> main : : Int =
32
- // FIXME:
47
+ // expected-error@-1 3{{type 'Int' is not imported through module 'main'}}
48
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{14-18=Swift}}
49
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{25-29=Swift}}
50
+ // expected-note@-4 {{did you mean module 'Swift'?}} {{39-43=Swift}}
33
51
( main: : + )
34
- // expected-error@-1 {{cannot convert value of type '()' to specified type '(Int, Int) -> Int'}}
52
+ // FIXME: it'd be nice to handle module selectors on operators.
35
53
// expected-error@-2 {{expected expression}}
36
54
// expected-error@-3 {{expected expression after operator}}
37
55
38
56
let magnitude : Int . main : : Magnitude = main: : magnitude
39
- // expected-EVENTUALLY-error@-1 {{can't find 'Int'}}
40
- // FIXME improve: expected-error@-2 {{type alias 'Magnitude' is not a member type of 'Int'}}
41
- // FIXME: expected-error@-3 {{variable used within its own initial value}}
57
+ // expected-error@-1 {{type 'Magnitude' is not imported through module 'main'}}
58
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{24-28=Swift}}
59
+ // FIXME incorrect: expected-error@-3 {{variable used within its own initial value}}
60
+
42
61
if main: : Bool. main : : rando m( ) {
62
+ // FIXME improve: expected-error@-1 {{use of unresolved identifier 'main::Bool'}}
63
+
43
64
main: : negate( )
44
- // FIXME improve: expected-error@-1 {{use of unresolved identifier 'main::negate'}}
65
+ // FIXME improve, suggest adding 'self.' : expected-error@-1 {{use of unresolved identifier 'main::negate'}}
45
66
}
46
67
else {
47
68
self = main : : B( value: . main: : min)
69
+ // FIXME improve: expected-error@-1 {{use of unresolved identifier 'main::B'}}
70
+ // expected-error@-2 {{cannot infer contextual base in reference to member 'main::min'}}
48
71
}
49
72
50
73
self . main : : myNegate( )
@@ -58,30 +81,45 @@ extension B: main::Equatable {
58
81
extension C { }
59
82
60
83
extension ModuleSelectorTestingKit : : C : ModuleSelectorTestingKit : : Equatable {
61
- // FIXME improve: expected-error@-1 {{use of undeclared type 'ModuleSelectorTestingKit::Equatable'}}
84
+ // expected-error@-1 {{type 'Equatable' is not imported through module 'ModuleSelectorTestingKit'}}
85
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{39-62=Swift}}
86
+
62
87
@_implements ( ModuleSelectorTestingKit: : Equatable, ModuleSelectorTestingKit: : == ( _: _: ) )
63
- // FIXME improve: expected-error@-1 {{use of undeclared type 'ModuleSelectorTestingKit::Equatable'}}
64
- // expected-error@-2 {{name cannot be qualified with module selector here}} {{52-77=}}
65
- public static func equals( _: ModuleSelectorTestingKit : : C, _: ModuleSelectorTestingKit : : C) -> ModuleSelectorTestingKit : : Bool { ModuleSelectorTestingKit: : fatalError( ) }
66
- // FIXME improve: expected-error@-1 {{use of undeclared type 'ModuleSelectorTestingKit::Bool'}}
88
+ // expected-error@-1 {{name cannot be qualified with module selector here}} {{52-77=}}
89
+ // expected-error@-2 {{type 'Equatable' is not imported through module 'ModuleSelectorTestingKit'}}
90
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{16-39=Swift}}
91
+
92
+ public static func equals( _: ModuleSelectorTestingKit : : C, _: ModuleSelectorTestingKit : : C) -> ModuleSelectorTestingKit : : Bool {
93
+ // expected-error@-1 {{type 'Bool' is not imported through module 'ModuleSelectorTestingKit'}}
94
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{94-117=Swift}}
95
+ ModuleSelectorTestingKit: : fatalError( )
96
+ // expected-EVENTUALLY-error@-1 {{type 'fatalError' is not imported through module 'main'}}
97
+ // expected-EVENTUALLY-note@-2 {{did you mean module 'Swift'?}} {{4-8=Swift}}
98
+ }
67
99
68
100
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
69
101
// @_derivative(of:)
70
102
71
103
@_dynamicReplacement ( for: ModuleSelectorTestingKit: : negate( ) )
72
104
mutating func myNegate( ) {
73
105
let fn : ( ModuleSelectorTestingKit: : Int , ModuleSelectorTestingKit : : Int ) -> ModuleSelectorTestingKit : : Int =
74
- // FIXME improve: expected-error@-1 3{{use of undeclared type 'ModuleSelectorTestingKit::Int'}}
75
- // FIXME:
106
+ // expected-error@-1 3{{type 'Int' is not imported through module 'ModuleSelectorTestingKit'}}
107
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{14-37=Swift}}
108
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{44-67=Swift}}
109
+ // expected-note@-4 {{did you mean module 'Swift'?}} {{77-100=Swift}}
76
110
( ModuleSelectorTestingKit: : + )
77
- // expected-error@-1 {{expected expression}}
78
- // expected-error@-2 {{expected expression after operator}}
111
+ // FIXME: it'd be nice to handle module selectors on operators.
112
+ // expected-error@-2 {{expected expression}}
113
+ // expected-error@-3 {{expected expression after operator}}
114
+
79
115
let magnitude : Int . ModuleSelectorTestingKit : : Magnitude = ModuleSelectorTestingKit: : magnitude
80
- // expected-EVENTUALLY-error@-1 {{something about not finding 'magnitude' because we didn't look in self}}
81
- // FIXME improve: expected-error@-2 {{type alias 'Magnitude' is not a member type of 'Int'}}
82
- // FIXME: expected-error@-3 {{variable used within its own initial value}}
116
+ // expected-error@-1 {{type 'Magnitude' is not imported through module 'ModuleSelectorTestingKit'}}
117
+ // expected-note@-2 {{did you mean module 'Swift'?}} {{24-47=Swift}}
118
+ // FIXME incorrect: expected-error@-3 {{variable used within its own initial value}}
119
+
83
120
if ModuleSelectorTestingKit : : Bool. ModuleSelectorTestingKit : : rando m( ) {
84
121
// FIXME improve: expected-error@-1 {{use of unresolved identifier 'ModuleSelectorTestingKit::Bool'}}
122
+
85
123
ModuleSelectorTestingKit: : negate( )
86
124
// FIXME improve, suggest adding 'self.': expected-error@-1 {{use of unresolved identifier 'ModuleSelectorTestingKit::negate'}}
87
125
}
@@ -100,13 +138,22 @@ extension ModuleSelectorTestingKit::C: ModuleSelectorTestingKit::Equatable {
100
138
// FIXME: Many more of these should fail once the feature is actually implemented.
101
139
102
140
extension Swift : : D { }
103
- // FIXME improve: expected-error@-1 {{use of undeclared type 'Swift::D'}}
141
+ // expected-error@-1 {{type 'D' is not imported through module 'Swift'}}
142
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{11-16=ModuleSelectorTestingKit}}
104
143
105
144
extension D : @retroactive Swift : : Equatable {
145
+ // Caused by Swift::D failing to typecheck in `equals(_:_:)`: expected-error@-1 *{{extension outside of file declaring struct 'D' prevents automatic synthesis of '==' for protocol 'Equatable'}} expected-note@-1 *{{add stubs for conformance}}
146
+
106
147
@_implements ( Swift: : Equatable, Swift: : == ( _: _: ) )
107
148
// expected-error@-1 {{name cannot be qualified with module selector here}} {{34-41=}}
108
- public static func equals( _: Swift : : D, _: Swift : : D) -> Swift : : Bool { Swift: : fatalError( ) }
109
-
149
+
150
+ public static func equals( _: Swift : : D, _: Swift : : D) -> Swift : : Bool {
151
+ // expected-error@-1 2{{type 'D' is not imported through module 'Swift'}}
152
+ // expected-note@-2 {{did you mean module 'ModuleSelectorTestingKit'?}} {{32-37=ModuleSelectorTestingKit}}
153
+ // expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{45-50=ModuleSelectorTestingKit}}
154
+ Swift: : fatalError( )
155
+ }
156
+
110
157
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
111
158
// @_derivative(of:)
112
159
@@ -128,6 +175,8 @@ extension D: @retroactive Swift::Equatable {
128
175
}
129
176
else {
130
177
self = Swift : : D( value: . Swift: : min)
178
+ // FIXME improve: expected-error@-1 {{use of unresolved identifier 'Swift::D'}}
179
+ // expected-error@-2 {{cannot infer contextual base in reference to member 'Swift::min'}}
131
180
}
132
181
133
182
self . Swift : : myNegate( )
@@ -202,13 +251,16 @@ func main::decl1(
202
251
// expected-error@-1 {{name of function declaration cannot be qualified with module selector}}
203
252
main: : p1: main: : A,
204
253
// expected-error@-1 {{argument label cannot be qualified with module selector}}
205
- // FIXME access path: expected-error@-2 {{use of undeclared type 'main::A'}}
254
+ // FIXME access path: expected-error@-2 {{type 'A' is not imported through module 'main'}}
255
+ // FIXME access path: expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{13-17=ModuleSelectorTestingKit}}
206
256
main: : label p2 : main: : A,
207
257
// expected-error@-1 {{argument label cannot be qualified with module selector}}
208
- // FIXME access path: expected-error@-2 {{use of undeclared type 'main::A'}}
258
+ // FIXME access path: expected-error@-2 {{type 'A' is not imported through module 'main'}}
259
+ // FIXME access path: expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{19-23=ModuleSelectorTestingKit}}
209
260
label main: : p3: main: : A
210
261
// expected-error@-1 {{name of parameter declaration cannot be qualified with module selector}}
211
- // FIXME access path: expected-error@-2 {{use of undeclared type 'main::A'}}
262
+ // FIXME access path: expected-error@-2 {{type 'A' is not imported through module 'main'}}
263
+ // FIXME access path: expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{19-23=ModuleSelectorTestingKit}}
212
264
) {
213
265
let main : : decl1a = " a "
214
266
// expected-error@-1 {{name of constant declaration cannot be qualified with module selector}}
@@ -292,7 +344,8 @@ class main::decl4<main::T> {}
292
344
293
345
typealias main : : decl5 = main : : Bool
294
346
// expected-error@-1 {{name of typealias declaration cannot be qualified with module selector}}
295
- // FIXME improve: expected-error@-2 {{use of undeclared type 'main::Bool'}}
347
+ // expected-error@-2 {{type 'Bool' is not imported through module 'main'}}
348
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{25-29=Swift}}
296
349
297
350
protocol main: : decl6 {
298
351
// expected-error@-1 {{name of protocol declaration cannot be qualified with module selector}}
@@ -333,7 +386,8 @@ struct Parent {
333
386
334
387
typealias main : : decl5 = main : : Bool
335
388
// expected-error@-1 {{name of typealias declaration cannot be qualified with module selector}}
336
- // FIXME improve: expected-error@-2 {{use of undeclared type 'main::Bool'}}
389
+ // expected-error@-2 {{type 'Bool' is not imported through module 'main'}}
390
+ // expected-note@-3 {{did you mean module 'Swift'?}} {{27-31=Swift}}
337
391
}
338
392
339
393
@_swift_native_objc_runtime_base ( main: : BaseClass)
0 commit comments