From e71f0117137c30db1dd694aa2c91c82174fa05df Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Wed, 13 Dec 2023 16:41:45 -0500 Subject: [PRISM] Fix bugs in compiling optional keyword parameters This PR fixes two bugs when compiling optional keyword parameters: - It moves keyword parameter compilation to STEP 5 in the parameters sequence, where the rest of compilation happens. This is important because keyword parameter compilation relies on the value of body->param.keyword->bits_start which gets set in an earlier step - It compiles array and hash values for keyword parameters, which it didn't previously --- test/ruby/test_compile_prism.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 7bd63eb611..f89aabfc0e 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1178,6 +1178,12 @@ module Prism end prism_test_def_node(10, b: 3) CODE + assert_prism_eval(<<-CODE) + def self.prism_test_def_node(a: []) + a + end + prism_test_def_node + CODE # block arguments assert_prism_eval("def self.prism_test_def_node(&block) block end; prism_test_def_node{}.class") -- cgit v1.2.3