@@ -64,13 +64,19 @@ extension A: @retroactive Swift::Equatable {
64
64
// Test resolution of main:: using `B`
65
65
66
66
extension main : : B { }
67
+ // FIXME improve: expected-error@-1 {{cannot find type 'main::B' in scope}}
67
68
68
69
extension B : @retroactive main : : Equatable {
70
+ // FIXME improve: expected-error@-1 {{cannot find type 'main::Equatable' in scope}}
69
71
70
72
@_implements ( main: : Equatable, == ( _: _: ) )
73
+ // FIXME improve: expected-error@-1 {{cannot find type 'main::Equatable' in scope}}
71
74
72
75
public static func equals( _: main : : B, _: main : : B) -> main : : Bool {
73
- main: : fatalError( )
76
+ // FIXME improve: expected-error@-1 {{cannot find type 'main::B' in scope}}
77
+ // FIXME improve: expected-error@-2 {{cannot find type 'main::B' in scope}}
78
+ // FIXME improve: expected-error@-3 {{cannot find type 'main::Bool' in scope}}
79
+ main: : fatalError( ) // no-error -- not typechecking function bodies
74
80
}
75
81
76
82
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -81,6 +87,7 @@ extension B: @retroactive main::Equatable {
81
87
82
88
mutating func myNegate( ) {
83
89
let fn : ( main: : Int , main : : Int ) -> main : : Int =
90
+ // FIXME improve: expected-error@-1 3{{cannot find type 'main::Int' in scope}}
84
91
( main: : + )
85
92
86
93
let magnitude : Int . main : : Magnitude = main: : magnitude
@@ -89,19 +96,23 @@ extension B: @retroactive main::Equatable {
89
96
_ = ( fn, magnitude)
90
97
91
98
if main: : Bool. main : : rando m( ) {
99
+ // FIXME improve: expected-error@-1 {{cannot find 'main::Bool' in scope}}
92
100
93
101
main: : negate( )
94
102
// FIXME improve: expected-error@-1 {{cannot find 'main::negate' in scope}}
95
103
}
96
104
else {
97
105
self = main : : B( value: . main: : min)
106
+ // FIXME improve: expected-error@-1 {{cannot find 'main::B' in scope}}
107
+ // expected-error@-2 {{cannot infer contextual base in reference to member 'main::min'}}
98
108
99
109
self = B . main : : init( value: . min)
100
110
}
101
111
102
112
self . main : : myNegate( )
103
113
104
114
main: : fatalError( )
115
+ // FIXME improve: expected-error@-1 {{cannot find 'main::fatalError' in scope}}
105
116
}
106
117
107
118
// FIXME: Can we test @convention(witness_method:)?
@@ -112,11 +123,15 @@ extension B: @retroactive main::Equatable {
112
123
extension ModuleSelectorTestingKit : : C { }
113
124
114
125
extension C : @retroactive ModuleSelectorTestingKit : : Equatable {
126
+ // FIXME improve: expected-error@-1 {{cannot find type 'ModuleSelectorTestingKit::Equatable' in scope}}
115
127
116
128
@_implements ( ModuleSelectorTestingKit: : Equatable, == ( _: _: ) )
129
+ // FIXME improve: expected-error@-1 {{cannot find type 'ModuleSelectorTestingKit::Equatable' in scope}}
117
130
118
131
public static func equals( _: ModuleSelectorTestingKit : : C, _: ModuleSelectorTestingKit : : C) -> ModuleSelectorTestingKit : : Bool {
119
- ModuleSelectorTestingKit: : fatalError( )
132
+ // FIXME improve: expected-error@-1 {{cannot find type 'ModuleSelectorTestingKit::Bool' in scope}}
133
+
134
+ ModuleSelectorTestingKit: : fatalError( ) // no-error -- not typechecking function bodies
120
135
}
121
136
122
137
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -126,6 +141,7 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
126
141
127
142
mutating func myNegate( ) {
128
143
let fn : ( ModuleSelectorTestingKit: : Int , ModuleSelectorTestingKit : : Int ) -> ModuleSelectorTestingKit : : Int =
144
+ // FIXME improve: expected-error@-1 3{{cannot find type 'ModuleSelectorTestingKit::Int' in scope}}
129
145
( ModuleSelectorTestingKit: : + )
130
146
131
147
let magnitude : Int . ModuleSelectorTestingKit : : Magnitude = ModuleSelectorTestingKit: : magnitude
@@ -134,6 +150,7 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
134
150
_ = ( fn, magnitude)
135
151
136
152
if ModuleSelectorTestingKit : : Bool. ModuleSelectorTestingKit : : rando m( ) {
153
+ // FIXME improve: expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::Bool' in scope}}
137
154
138
155
ModuleSelectorTestingKit: : negate( )
139
156
// expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::negate' in scope}}
@@ -147,6 +164,7 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
147
164
self . ModuleSelectorTestingKit : : myNegate( )
148
165
149
166
ModuleSelectorTestingKit: : fatalError( )
167
+ // FIXME improve: expected-error@-1 {{cannot find 'ModuleSelectorTestingKit::fatalError' in scope}}
150
168
}
151
169
152
170
// FIXME: Can we test @convention(witness_method:)?
@@ -155,12 +173,16 @@ extension C: @retroactive ModuleSelectorTestingKit::Equatable {
155
173
// Test resolution of Swift:: using `D`
156
174
157
175
extension Swift : : D { }
176
+ // FIXME improve: expected-error@-1 {{cannot find type 'Swift::D' in scope}}
158
177
159
178
extension D : @retroactive Swift : : Equatable {
179
+ // 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}}
160
180
161
181
@_implements ( Swift: : Equatable, == ( _: _: ) )
162
182
public static func equals( _: Swift : : D, _: Swift : : D) -> Swift : : Bool {
163
- Swift: : fatalError( )
183
+ // expected-error@-1 {{cannot find type 'Swift::D' in scope}}
184
+ // expected-error@-2 {{cannot find type 'Swift::D' in scope}}
185
+ Swift: : fatalError( ) // no-error -- not typechecking function bodies
164
186
}
165
187
166
188
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -175,7 +197,7 @@ extension D: @retroactive Swift::Equatable {
175
197
( Swift: : + )
176
198
177
199
let magnitude : Int . Swift : : Magnitude = Swift: : magnitude
178
- // expected-error@-1 {{cannot convert value of type 'Never' to specified type 'Int.Magnitude' (aka 'UInt') }}
200
+ // expected-error@-1 {{cannot find 'Swift::magnitude' in scope }}
179
201
180
202
_ = ( fn, magnitude)
181
203
@@ -186,6 +208,8 @@ extension D: @retroactive Swift::Equatable {
186
208
}
187
209
else {
188
210
self = Swift : : D( value: . Swift: : min)
211
+ // FIXME improve: expected-error@-1 {{cannot find 'Swift::D' in scope}}
212
+ // expected-error@-2 {{cannot infer contextual base in reference to member 'Swift::min'}}
189
213
190
214
self = D . Swift : : init( value: . min)
191
215
}
@@ -199,7 +223,6 @@ extension D: @retroactive Swift::Equatable {
199
223
}
200
224
201
225
let mog : Never = fatalError ( )
202
- // expected-note@-1 {{did you mean 'mog'?}}
203
226
204
227
func localVarsCantBeAccessedByModuleSelector( ) {
205
228
let mag : Int . Swift : : Magnitude = main: : mag
@@ -212,55 +235,62 @@ struct AvailableUser {
212
235
@available ( macOS 10 . 15 , * ) var use1 : String { " foo " }
213
236
214
237
@main : : available( ) var use2
238
+ // FIXME improve: expected-error@-1 {{unknown attribute 'available'}}
239
+ // FIXME suppress: expected-error@-2 {{type annotation missing in pattern}}
215
240
216
241
@ModuleSelectorTestingKit : : available( ) var use4
217
242
// no-error
218
243
219
244
@Swift : : available( ) var use5
245
+ // FIXME improve: expected-error@-1 {{unknown attribute 'available'}}
246
+ // FIXME suppress: expected-error@-2 {{type annotation missing in pattern}}
220
247
}
221
248
222
249
func builderUser2( @main : : MyBuilder fn: ( ) -> Void) { }
250
+ // FIXME improve: expected-error@-1 {{unknown attribute 'MyBuilder'}}
223
251
224
252
func builderUser3 ( @ModuleSelectorTestingKit : : MyBuilder fn: ( ) - > Void) { }
253
+ // no-error
225
254
226
255
func builderUser4( @Swift : : MyBuilder fn: ( ) - > Void) { }
256
+ // FIXME improve: expected-error@-1 {{unknown attribute 'MyBuilder'}}
227
257
228
258
// Error cases
229
259
230
260
func decl1(
231
261
p1: main: : A,
262
+ // FIXME: expected-error@-1 {{cannot find type 'main::A' in scope}}
232
263
label p2 : inout A,
233
264
label p3 : @escaping ( ) - > A
234
265
) {
235
266
switch Optional ( main: : p2) {
236
267
case Optional . some( let decl1i) :
237
- // expected-warning@-1 {{immutable value 'decl1i' was never used; consider replacing with '_' or removing it}}
238
268
break
239
269
case . none:
240
270
break
241
271
}
242
272
243
273
switch Optional ( main: : p2) {
244
274
case let Optional . some( decl1j) :
245
- // expected-warning@-1 {{immutable value 'decl1j' was never used; consider replacing with '_' or removing it}}
246
275
break
247
276
case . none:
248
277
break
249
278
}
250
279
251
280
switch Optional ( main: : p2) {
252
281
case let decl1k? :
253
- // expected-warning@-1 {{immutable value 'decl1k' was never used; consider replacing with '_' or removing it}}
254
282
break
255
283
case . none:
256
284
break
257
285
}
258
286
}
259
287
260
288
typealias decl5 = main: : Bool
289
+ // FIXME improve: expected-error@-1 {{cannot find type 'main::Bool' in scope}}
261
290
262
291
func badModuleNames( ) {
263
292
NonexistentModule: : print( )
293
+ // expected-error@-1 {{cannot find 'NonexistentModule::print' in scope}}
264
294
265
295
_ = " foo " . NonexistentModule: : count
266
296
0 commit comments