Skip to content

Commit

Permalink
Change short reference for top-level macros to ::foo (#14203)
Browse files Browse the repository at this point in the history
  • Loading branch information
femto authored Jan 12, 2024
1 parent 3bf68dd commit e814029
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/compiler/macro/macro_methods_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3565,7 +3565,7 @@ module Crystal
# there are no macro methods with required named parameters

it "uses correct name for top-level macro methods" do
assert_macro_error %({{flag?}}), "wrong number of arguments for top-level macro 'flag?' (given 0, expected 1)"
assert_macro_error %({{flag?}}), "wrong number of arguments for macro '::flag?' (given 0, expected 1)"
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/macros/methods.cr
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ module Crystal

def interpret_run(node)
if node.args.size == 0
node.wrong_number_of_arguments "top-level macro 'run'", 0, "1+"
node.wrong_number_of_arguments "macro '::run'", 0, "1+"
end

node.args.first.accept self
Expand Down Expand Up @@ -2841,7 +2841,7 @@ end

private def full_macro_name(node, method, top_level)
if top_level
"top-level macro '#{method}'"
"macro '::#{method}'"
else
"macro '#{node.class_desc}##{method}'"
end
Expand Down

0 comments on commit e814029

Please sign in to comment.