summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prism_compile.c10
-rw-r--r--test/ruby/test_compile_prism.rb4
-rw-r--r--tool/prism_btests2
3 files changed, 9 insertions, 7 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 5006ce50e8..3afc6ae5db 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -5137,12 +5137,10 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
PM_NODE_TYPE_P(cast->rest, PM_SPLAT_NODE) &&
(((pm_splat_node_t *)cast->rest)->expression));
- if (cast->lefts.size) {
- int flag = (int) (bool) cast->rights.size || has_rest_expression;
- ADD_INSN2(ret, &dummy_line_node, expandarray, INT2FIX(cast->lefts.size), INT2FIX(flag));
- for (size_t index = 0; index < cast->lefts.size; index++) {
- PM_COMPILE_NOT_POPPED(cast->lefts.nodes[index]);
- }
+ int flag = (int) (bool) cast->rights.size || has_rest_expression;
+ ADD_INSN2(ret, &dummy_line_node, expandarray, INT2FIX(cast->lefts.size), INT2FIX(flag));
+ for (size_t index = 0; index < cast->lefts.size; index++) {
+ PM_COMPILE_NOT_POPPED(cast->lefts.nodes[index]);
}
if (has_rest_expression) {
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index ac13f26e7c..87221289e2 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -1330,6 +1330,10 @@ module Prism
assert_prism_eval("def self.foo(_a, _a); _a; end; foo(1, 2)")
end
+ def test_splat_params_with_no_lefties
+ assert_prism_eval("def self.foo(v, (*)); v; end; foo(1, [2, 3, 4])")
+ end
+
def test_method_parameters
assert_prism_eval(<<-CODE)
def self.prism_test_method_parameters(a, b=1, *c, d:, e: 2, **f, &g)
diff --git a/tool/prism_btests b/tool/prism_btests
index 6ce7630153..2eda5e624e 100644
--- a/tool/prism_btests
+++ b/tool/prism_btests
@@ -20,7 +20,7 @@
../src/bootstraptest/test_string.rb
../src/bootstraptest/test_struct.rb
../src/bootstraptest/test_thread.rb
-# ../src/bootstraptest/test_block.rb
+../src/bootstraptest/test_block.rb
# ../src/bootstraptest/test_exception.rb
# ../src/bootstraptest/test_flow.rb
# ../src/bootstraptest/test_insns.rb