Skip to content

Commit 9648f2b

Browse files
authored
Fix missing param count in compilation error message (#13985)
1 parent 3a83996 commit 9648f2b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

spec/compiler/semantic/macro_spec.cr

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,24 @@ describe "Semantic: macro" do
271271
CRYSTAL
272272
end
273273

274+
it "errors if find macros but missing argument" do
275+
assert_error(<<-CRYSTAL, "wrong number of arguments for macro 'foo' (given 0, expected 1)")
276+
macro foo(x)
277+
1
278+
end
279+
280+
foo
281+
CRYSTAL
282+
283+
assert_error(<<-CRYSTAL, "wrong number of arguments for macro 'foo' (given 0, expected 1)")
284+
private macro foo(x)
285+
1
286+
end
287+
288+
foo
289+
CRYSTAL
290+
end
291+
274292
describe "raise" do
275293
describe "inside macro" do
276294
describe "without node" do

src/compiler/crystal/semantic/call_error.cr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,6 @@ class Crystal::Call
902902

903903
macros = in_macro_target &.lookup_macros(def_name)
904904
return unless macros.is_a?(Array(Macro))
905-
macros = macros.reject &.visibility.private?
906905

907906
if msg = single_def_error_message(macros, named_args)
908907
raise msg

0 commit comments

Comments
 (0)