Skip to content

Commit 8fc80f9

Browse files
committed
[Sema] Make "not-imported" diagnostic more direct
1 parent 9127f90 commit 8fc80f9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,7 @@ ERROR(decl_from_hidden_module,none,
29042904
"%select{%3 has been imported as implementation-only|"
29052905
"it is an SPI imported from %3|"
29062906
"it is SPI|"
2907-
"%3 was implicitly imported}4",
2907+
"%3 was not imported by this file}4",
29082908
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
29092909
WARNING(decl_from_hidden_module_warn,none,
29102910
"cannot use %0 %1 %select{here|as property wrapper here|"
@@ -2913,7 +2913,7 @@ WARNING(decl_from_hidden_module_warn,none,
29132913
"in an extension with conditional conformances}2; "
29142914
"%select{%3 has been imported as implementation-only|"
29152915
"<<ERROR>>|<<ERROR>>|"
2916-
"%3 was implicitly imported}4",
2916+
"%3 was not imported by this file}4",
29172917
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
29182918
ERROR(conformance_from_implementation_only_module,none,
29192919
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
@@ -5785,13 +5785,13 @@ ERROR(inlinable_decl_ref_from_hidden_module,
57855785
"because %select{%3 was imported implementation-only|"
57865786
"it is an SPI imported from %3|"
57875787
"it is SPI|"
5788-
"%3 was implicitly imported}4",
5788+
"%3 was not imported by this file}4",
57895789
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
57905790

57915791
WARNING(inlinable_decl_ref_from_hidden_module_warn,
57925792
none, "%0 %1 cannot be used in " FRAGILE_FUNC_KIND "2 "
57935793
"because %select{<<ERROR>>|<<ERROR>>|<<ERROR>>|"
5794-
"%3 was implicitly imported}4"
5794+
"%3 was not imported by this file}4"
57955795
"; this is an error in Swift 6",
57965796
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
57975797

test/Sema/implicit-import-in-inlinable-code.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import libA
3636

3737
@inlinable public func bar() {
3838
let a = ImportedType()
39-
a.implicitlyImportedMethod() // expected-warning {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported; this is an error in Swift 6}}
39+
a.implicitlyImportedMethod() // expected-warning {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was not imported by this file; this is an error in Swift 6}}
4040

4141
// Expected implicit imports are still fine
4242
a.localModuleMethod()
@@ -48,7 +48,7 @@ import libA
4848

4949
@inlinable public func bar() {
5050
let a = ImportedType()
51-
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported}}
51+
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was not imported by this file}}
5252

5353
// Expected implicit imports are still fine
5454
a.localModuleMethod()
@@ -59,7 +59,7 @@ import libA
5959

6060
@inlinable public func bar() {
6161
let a = ImportedType()
62-
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported}}
62+
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was not imported by this file}}
6363

6464
// Expected implicit imports are still fine
6565
a.localModuleMethod()

0 commit comments

Comments
 (0)