Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bdd3170619a6
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6d3b5a4236b9
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Nov 18, 2016

  1. Fixed wrong error message

    Ary Borenszweig committed Nov 18, 2016
    Copy the full SHA
    6d3b5a4 View commit details
Showing with 16 additions and 0 deletions.
  1. +13 −0 spec/compiler/semantic/macro_spec.cr
  2. +3 −0 src/compiler/crystal/semantic/call_error.cr
13 changes: 13 additions & 0 deletions spec/compiler/semantic/macro_spec.cr
Original file line number Diff line number Diff line change
@@ -934,4 +934,17 @@ describe "Semantic: macro" do
Foo.foo
), inject_primitives: false) { int32 }
end

it "gives correct error when method is invoked but macro exists at the same scope" do
assert_error %(
macro foo(x)
end
class Foo
end
Foo.new.foo
),
"undefined method 'foo'"
end
end
3 changes: 3 additions & 0 deletions src/compiler/crystal/semantic/call_error.cr
Original file line number Diff line number Diff line change
@@ -480,6 +480,9 @@ class Crystal::Call
end

def check_macro_wrong_number_of_arguments(def_name)
obj = self.obj
return if obj && !obj.is_a?(Path)

macros = in_macro_target &.lookup_macros(def_name)
return unless macros