Skip to content

[5.9] Update macro help in driver and diagnostics #67886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -7113,9 +7113,7 @@ ERROR(macro_undefined,PointsToFirstBadToken,
"no macro named %0", (Identifier))
ERROR(external_macro_not_found,none,
"external macro implementation type '%0.%1' could not be found for "
"macro %2; the type must be public and provided by a macro target in a "
"Swift package, or via '-plugin-path' or '-load-plugin-library'",
(StringRef, StringRef, DeclName))
"macro %2", (StringRef, StringRef, DeclName))
ERROR(macro_must_be_defined,none,
"macro %0 requires a definition", (DeclName))
ERROR(external_macro_outside_macro_definition,none,
Expand Down
4 changes: 2 additions & 2 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1823,8 +1823,8 @@ def load_plugin_library:
def load_plugin_executable:
Separate<["-"], "load-plugin-executable">, Group<plugin_search_Group>,
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,
HelpText<"Path to an executable compiler plugins and providing module names "
"such as macros">,
HelpText<"Path to a compiler plugin executable and a comma-separated list "
"of module names where the macro types are declared">,
MetaVarName<"<path>#<module-names>">;

include "FrontendOptions.td"
4 changes: 2 additions & 2 deletions test/Macros/macro_plugin_broken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
// RUN: c-index-test -read-diagnostics %t/macro_expand.dia 2>&1 | %FileCheck -check-prefix CHECK %s

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

//--- test.swift
Expand Down
2 changes: 1 addition & 1 deletion test/Macros/macros_diagnostics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func shadow(a: Int, b: Int, stringify: Int) {
}

func testMissing() {
#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'}}
#missingMacro1("hello") // expected-error{{external macro implementation type 'MissingModule.MissingType' could not be found for macro 'missingMacro1'}}
}

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