Incorrectly reporting shadowingOuterLocalVar within macro included

closes #161
This commit is contained in:
Vitalii Elenhaupt 2020-07-15 10:18:12 +03:00
parent 7f501a1df5
commit d650ca5477
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0
4 changed files with 41 additions and 7 deletions

View file

@ -213,6 +213,29 @@ module Ameba::Rule::Lint
)
subject.catch(source).should be_valid
end
it "does not report shadowed vars withing nested macro" do
source = Source.new %(
module Foo
macro included
def foo
{% for ann in instance_vars %}
{% pos_args = ann.args.empty? ? "Tuple.new".id : ann.args %}
{% end %}
end
def bar
{{@type.instance_vars.map do |ivar|
ivar.annotations(Name).each do |ann|
puts ann.args
end
end}}
end
end
end
)
subject.catch(source).should be_valid
end
end
end
end