Skip to content

Commit e740a77

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 427a581 commit e740a77

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
@@ -50,6 +50,8 @@ extension ModuleSelectorTestingKit::A: Swift::Equatable {
5050
}
5151

5252
self.main::myNegate()
53+
54+
Swift::fatalError()
5355
}
5456

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

8383
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -119,6 +119,10 @@ extension B: main::Equatable {
119119
}
120120

121121
self.main::myNegate()
122+
123+
main::fatalError()
124+
// expected-error@-1 {{declaration 'fatalError' is not imported through module 'main'}}
125+
// expected-note@-2 {{did you mean module 'Swift'?}} {{5-9=Swift}}
122126
}
123127

124128
// FIXME: Can we test @convention(witness_method:)?
@@ -140,9 +144,7 @@ extension C: ModuleSelectorTestingKit::Equatable {
140144
public static func equals(_: ModuleSelectorTestingKit::C, _: ModuleSelectorTestingKit::C) -> ModuleSelectorTestingKit::Bool {
141145
// expected-error@-1 {{type 'Bool' is not imported through module 'ModuleSelectorTestingKit'}}
142146
// expected-note@-2 {{did you mean module 'Swift'?}} {{96-120=Swift}}
143-
ModuleSelectorTestingKit::fatalError()
144-
// expected-EVENTUALLY-error@-1 {{declaration 'fatalError' is not imported through module 'ModuleSelectorTestingKit'}}
145-
// expected-EVENTUALLY-note@-2 {{did you mean module 'Swift'?}} {{4-8=Swift}}
147+
ModuleSelectorTestingKit::fatalError() // no-error: body not typechecked
146148
}
147149

148150
// FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
@@ -184,6 +186,10 @@ extension C: ModuleSelectorTestingKit::Equatable {
184186
self.ModuleSelectorTestingKit::myNegate()
185187
// expected-error@-1 {{declaration 'myNegate()' is not imported through module 'ModuleSelectorTestingKit'}}
186188
// expected-note@-2 {{did you mean module 'main'?}} {{10-34=main}}
189+
190+
ModuleSelectorTestingKit::fatalError()
191+
// expected-error@-1 {{declaration 'fatalError' is not imported through module 'ModuleSelectorTestingKit'}}
192+
// expected-note@-2 {{did you mean module 'Swift'?}} {{5-29=Swift}}
187193
}
188194

189195
// FIXME: Can we test @convention(witness_method:)?
@@ -244,6 +250,8 @@ extension D: Swift::Equatable {
244250
self.Swift::myNegate()
245251
// expected-error@-1 {{declaration 'myNegate()' is not imported through module 'Swift'}}
246252
// expected-note@-2 {{did you mean module 'main'?}} {{10-15=main}}
253+
254+
Swift::fatalError()
247255
}
248256

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

0 commit comments

Comments
 (0)