Skip to content

Commit

Permalink
Fix error when MASGN
Browse files Browse the repository at this point in the history
Fix #1330
  • Loading branch information
ksss committed Nov 1, 2023
1 parent f5373b3 commit 5fe6c6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rbs/prototype/rbi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def process(node, outer: [], comments:)
end
end
value_node = node.children.last
type = if value_node.type == :CALL && value_node.children[1] == :let
type = if value_node && value_node.type == :CALL && value_node.children[1] == :let
type_node = each_arg(value_node.children[2]).to_a[1]
type_of type_node, variables: current_module&.type_params || []
else
Expand Down
21 changes: 21 additions & 0 deletions test/rbs/rbi_prototype_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,25 @@ class Dir[out X, in Y, Z]
end
EOF
end

def test_masgn
parser = RBI.new

parser.parse <<-EOF
class Test
A, B, C = [1, 2, 3]
end
EOF

assert_write parser.decls, <<-EOF
class Test
end
Test::A: untyped
Test::B: untyped
Test::C: untyped
EOF
end
end

0 comments on commit 5fe6c6e

Please sign in to comment.