Skip to content

Commit ebe3a00

Browse files
authored
Merge pull request #67885 from bnbarham/improve-macro-diag
[Diagnostics] Reduce missing external macro diagnostic
2 parents d7d98c2 + 10a5ead commit ebe3a00

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7154,9 +7154,7 @@ ERROR(macro_undefined,PointsToFirstBadToken,
71547154
"no macro named %0", (Identifier))
71557155
ERROR(external_macro_not_found,none,
71567156
"external macro implementation type '%0.%1' could not be found for "
7157-
"macro %2; the type must be public and provided by a macro target in a "
7158-
"Swift package, or via '-plugin-path' or '-load-plugin-library'",
7159-
(StringRef, StringRef, DeclName))
7157+
"macro %2", (StringRef, StringRef, DeclName))
71607158
ERROR(macro_must_be_defined,none,
71617159
"macro %0 requires a definition", (DeclName))
71627160
ERROR(external_macro_outside_macro_definition,none,

test/Macros/macro_plugin_broken.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
// RUN: c-index-test -read-diagnostics %t/macro_expand.dia 2>&1 | %FileCheck -check-prefix CHECK %s
2121

2222
// CHECK: (null):0:0: warning: compiler plugin not loaded: {{.+}}broken-plugin; failed to initialize
23-
// CHECK: test.swift:1:33: warning: external macro implementation type 'TestPlugin.FooMacro' could not be found for macro 'fooMacro';
24-
// CHECK: test.swift:4:7: error: external macro implementation type 'TestPlugin.FooMacro' could not be found for macro 'fooMacro';
23+
// CHECK: test.swift:1:33: warning: external macro implementation type 'TestPlugin.FooMacro' could not be found for macro 'fooMacro'
24+
// CHECK: test.swift:4:7: error: external macro implementation type 'TestPlugin.FooMacro' could not be found for macro 'fooMacro'
2525
// CHECK: +-{{.+}}test.swift:1:33: note: 'fooMacro' declared here
2626

2727
//--- test.swift

test/Macros/macros_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func shadow(a: Int, b: Int, stringify: Int) {
136136
}
137137

138138
func testMissing() {
139-
#missingMacro1("hello") // expected-error{{external macro implementation type 'MissingModule.MissingType' could not be found for macro 'missingMacro1'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library'}}
139+
#missingMacro1("hello") // expected-error{{external macro implementation type 'MissingModule.MissingType' could not be found for macro 'missingMacro1'}}
140140
}
141141

142142
@freestanding(expression) macro undefined() // expected-error{{macro 'undefined()' requires a definition}}

0 commit comments

Comments
 (0)