summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-01-23 11:32:35 -0500
committerPeter Zhu <peter@peterzhu.ca>2024-01-24 10:08:25 -0500
commit529700d3145cc77271a70bc75ab91528b7a7b084 (patch)
treeeb72c302b359a7f0259e103169d7f009ce7320bd /test/ruby
parentd86c4e553ee8ff899a103a49db0b66c73c01135f (diff)
[PRISM] Nested MultiWriteNode with method calls
Fixes ruby/prism#2247.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index 682f50d1d6..6a30854ba8 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -653,6 +653,21 @@ module Prism
foo = Foo.new
_, foo.bar, _, foo.baz = 1
CODE
+
+ # Test nested writes with method calls
+ assert_prism_eval(<<~RUBY)
+ class Foo
+ attr_accessor :bar
+ end
+
+ a = Foo.new
+
+ (a.bar, a.bar), b = [1], 2
+ RUBY
+ assert_prism_eval(<<~RUBY)
+ h = {}
+ (h[:foo], h[:bar]), a = [1], 2
+ RUBY
end
############################################################################