Do not use ruby2_keywords for ... argument forwarding

This allows ... argument forwarding to benefit from Allocationless
Anonymous Splat Forwarding, allowing the `f` call below to not
allocate an array or a hash.

```ruby
a = [1]
kw = {b: 2}

def c(a, b:)
end

def f(...)
  c(...)
end

f(*a, **kw)
```

This temporarily skips prism locals tests until prism is changed
to use * and ** for ..., instead of using ruby2_keywords.

Ignore failures in rbs bundled gems tests, since they fail due
to this change.
This commit is contained in:
Jeremy Evans 2023-12-08 14:30:39 -08:00
Родитель 0f90a24a81
Коммит 4f77d8d328
5 изменённых файлов: 4 добавлений и 4 удалений

2
.github/workflows/ubuntu.yml поставляемый
Просмотреть файл

@ -99,7 +99,7 @@ jobs:
env:
RUBY_TESTOPTS: '-q --tty=no'
TESTS: ${{ matrix.test_task == 'check' && matrix.skipped_tests || '' }}
TEST_BUNDLED_GEMS_ALLOW_FAILURES: 'typeprof'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: 'rbs,typeprof'
PRECHECK_BUNDLED_GEMS: 'no'
- name: make skipped tests

Просмотреть файл

@ -1627,7 +1627,6 @@ static void numparam_pop(struct parser_params *p, NODE *prev_inner);
#else
#define arg_FWD_BLOCK idFWD_BLOCK
#endif
#define FORWARD_ARGS_WITH_RUBY2_KEYWORDS
#define RE_OPTION_ONCE (1<<16)
#define RE_OPTION_ENCODING_SHIFT 8

Просмотреть файл

@ -83,7 +83,7 @@ module Prism
filepath = File.join(base, relative)
define_method("test_#{relative}") { assert_locals(filepath) }
end
end if false # skip until ... uses * and ** and not ruby2_keywords
def setup
@previous_default_external = Encoding.default_external

Просмотреть файл

@ -11,6 +11,7 @@ module Prism
filepaths.each do |relative|
define_method("test_newline_flags_#{relative}") do
next if relative == 'locals_test.rb'
assert_newlines(base, relative)
end
end

Просмотреть файл

@ -661,7 +661,7 @@ class TestAst < Test::Unit::TestCase
node ? [node.children[-4], node.children[-2]&.children, node.children[-1]] : []
end
assert_equal([:*, nil, :&], forwarding.call('...'))
assert_equal([:*, [:**], :&], forwarding.call('...'))
end
def test_ranges_numbered_parameter