Skip to content

Commit 5eef82e

Browse files
committed
[NFC] Demonstrate that main::fatalError() works
We weren't seeing diagnostics in some test cases because the bodies weren't being typechecked.
1 parent a0a97c3 commit 5eef82e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/NameLookup/module_selector.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ extension ModuleSelectorTestingKit::A: @retroactive Swift::Equatable {
5252
}
5353

5454
self.main::myNegate()
55+
56+
Swift::fatalError()
5557
}
5658

5759
// FIXME: Can we test @convention(witness_method:)?
@@ -77,9 +79,7 @@ extension B: main::Equatable {
7779
// expected-note@-3 {{did you mean module 'ModuleSelectorTestingKit'?}} {{44-48=ModuleSelectorTestingKit}}
7880
// expected-error@-4 {{type 'Bool' is not imported through module 'main'}}
7981
// expected-note@-5 {{did you mean module 'Swift'?}} {{56-60=Swift}}
80-
main::fatalError()
81-
// expected-EVENTUALLY-error@-1 {{declaration 'fatalError' is not imported through module 'main'}}
82-
// expected-EVENTUALLY-note@-2 {{did you mean module 'Swift'?}} {{4-8=Swift}}
82+
main::fatalError() // no-error: body not typechecked
8383
}
8484

8585
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -122,6 +122,10 @@ extension B: main::Equatable {
122122
}
123123

124124
self.main::myNegate()
125+
126+
main::fatalError()
127+
// expected-error@-1 {{declaration 'fatalError' is not imported through module 'main'}}
128+
// expected-note@-2 {{did you mean module 'Swift'?}} {{5-9=Swift}}
125129
}
126130

127131
// FIXME: Can we test @convention(witness_method:)?
@@ -143,9 +147,7 @@ extension C: ModuleSelectorTestingKit::Equatable {
143147
public static func equals(_: ModuleSelectorTestingKit::C, _: ModuleSelectorTestingKit::C) -> ModuleSelectorTestingKit::Bool {
144148
// expected-error@-1 {{type 'Bool' is not imported through module 'ModuleSelectorTestingKit'}}
145149
// expected-note@-2 {{did you mean module 'Swift'?}} {{96-120=Swift}}
146-
ModuleSelectorTestingKit::fatalError()
147-
// expected-EVENTUALLY-error@-1 {{declaration 'fatalError' is not imported through module 'ModuleSelectorTestingKit'}}
148-
// expected-EVENTUALLY-note@-2 {{did you mean module 'Swift'?}} {{4-8=Swift}}
150+
ModuleSelectorTestingKit::fatalError() // no-error: body not typechecked
149151
}
150152

151153
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -187,6 +189,10 @@ extension C: ModuleSelectorTestingKit::Equatable {
187189
self.ModuleSelectorTestingKit::myNegate()
188190
// expected-error@-1 {{declaration 'myNegate()' is not imported through module 'ModuleSelectorTestingKit'}}
189191
// expected-note@-2 {{did you mean module 'main'?}} {{10-34=main}}
192+
193+
ModuleSelectorTestingKit::fatalError()
194+
// expected-error@-1 {{declaration 'fatalError' is not imported through module 'ModuleSelectorTestingKit'}}
195+
// expected-note@-2 {{did you mean module 'Swift'?}} {{5-29=Swift}}
190196
}
191197

192198
// FIXME: Can we test @convention(witness_method:)?
@@ -248,6 +254,8 @@ extension D: @retroactive Swift::Equatable {
248254
self.Swift::myNegate()
249255
// expected-error@-1 {{declaration 'myNegate()' is not imported through module 'Swift'}}
250256
// expected-note@-2 {{did you mean module 'main'?}} {{10-15=main}}
257+
258+
Swift::fatalError()
251259
}
252260

253261
// FIXME: Can we test @convention(witness_method:)?

0 commit comments

Comments
 (0)