зеркало из https://github.com/github/ruby.git
[Bug #20392] Block arguments duplication check at `super`
This commit is contained in:
Родитель
3680981c7b
Коммит
a850cd1a87
3
parse.y
3
parse.y
|
@ -2063,8 +2063,9 @@ get_nd_args(struct parser_params *p, NODE *node)
|
|||
return RNODE_FCALL(node)->nd_args;
|
||||
case NODE_QCALL:
|
||||
return RNODE_QCALL(node)->nd_args;
|
||||
case NODE_VCALL:
|
||||
case NODE_SUPER:
|
||||
return RNODE_SUPER(node)->nd_args;
|
||||
case NODE_VCALL:
|
||||
case NODE_ZSUPER:
|
||||
case NODE_YIELD:
|
||||
case NODE_RETURN:
|
||||
|
|
|
@ -2154,6 +2154,13 @@ eom
|
|||
assert_equal 0...1, exp.call(a: 0)
|
||||
end
|
||||
|
||||
def test_argument_forwarding_with_super
|
||||
assert_valid_syntax('def foo(...) super {}; end')
|
||||
assert_valid_syntax('def foo(...) super() {}; end')
|
||||
assert_syntax_error('def foo(...) super(...) {}; end', /both block arg and actual block/)
|
||||
assert_syntax_error('def foo(...) super(1, ...) {}; end', /both block arg and actual block/)
|
||||
end
|
||||
|
||||
def test_class_module_Object_ancestors
|
||||
assert_separately([], <<-RUBY)
|
||||
m = Module.new
|
||||
|
|
Загрузка…
Ссылка в новой задаче