Remove naive solution for #447

This commit is contained in:
Sijawusz Pur Rahnama 2024-01-22 17:15:52 +01:00
parent 590640b559
commit 17084f4a1d
2 changed files with 4 additions and 11 deletions

View File

@ -402,11 +402,12 @@ module Ameba::Rule::Lint
CRYSTAL
end
it "doesn't report type declaration as a call argument" do
pending "doesn't report type declaration as a call argument" do
expect_no_issues subject, <<-CRYSTAL
foo Foo(T), foo : T
foo Foo, foo : Nil
foo foo : String, bar : Int32?
foo foo : String
foo foo : String, bar : Int32?, baz : Bool
CRYSTAL
end

View File

@ -43,10 +43,7 @@ module Ameba::Rule::Lint
scope.variables.each do |var|
next if var.ignored? || var.used_in_macro? || var.captured_by_block?
if scope.assigns_type_dec?(var.name)
next if exclude_type_declarations? || expressions_with_call?(node)
end
next if exclude_type_declarations? && scope.assigns_type_dec?(var.name)
var.assignments.each do |assign|
check_assignment(source, assign, var)
@ -54,11 +51,6 @@ module Ameba::Rule::Lint
end
end
private def expressions_with_call?(node)
node.is_a?(Crystal::Expressions) &&
node.expressions.first?.is_a?(Crystal::Call)
end
private def check_assignment(source, assign, var)
return if assign.referenced?