From 6beaf010a447ce9fb35c85f9fb2f41685e2114ba Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 30 Aug 2023 13:09:02 -0400 Subject: [ruby/yarp] fix: binary CallNode with out-of-order arg and receiver The snippet added in this commit previously resulted in a CallNode with inverted start and end locations: > AssocNode(15...13)( > CallNode(15...13)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), which failed an assertion during serialization. After this change, it looks better: > AssocNode(12...13)( > CallNode(12...17)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), Found by the fuzzer. https://github.com/ruby/yarp/commit/040aa63ad6 --- test/yarp/fuzzer_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb index d75d1422f0..4d7a0af8e7 100644 --- a/test/yarp/fuzzer_test.rb +++ b/test/yarp/fuzzer_test.rb @@ -28,5 +28,10 @@ module YARP A B EOF + snippet "create a binary call node with arg before receiver", <<~EOF + <<-A.g/{/ + A + /, ""\\ + EOF end end -- cgit v1.2.3