Lint/UnusedArgument: fails to recognized used argument inside macro

closes #117
This commit is contained in:
Vitalii Elenhaupt 2019-10-27 21:32:55 +02:00
parent 677c75716f
commit 904b5beec2
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0
2 changed files with 16 additions and 1 deletions

View file

@ -228,6 +228,21 @@ module Ameba::Rule::Lint
)
subject.catch(s).should be_valid
end
it "doesn't report used args in macro literals" do
s = Source.new %(
def print(f : Array(U)) forall U
f.size.times do |i|
{% if U == Float64 %}
puts f[i].round(3)
{% else %}
puts f[i]
{% end %}
end
end
)
subject.catch(s).should be_valid
end
end
context "properties" do