mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Incorrectly reporting shadowingOuterLocalVar within macro included
closes #161
This commit is contained in:
parent
7f501a1df5
commit
d650ca5477
4 changed files with 41 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue