mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
FCALL shouldn't be forwarded from caller
When we forward an FCALL (a method call with an implicit self), we shouldn't forward the FCALL flag because it ignores method visibility checks. This patch removes the FCALL flag from callers. [Bug #21196]
This commit is contained in:
parent
93ac342afc
commit
595040ba27
2 changed files with 26 additions and 1 deletions
|
@ -1395,3 +1395,27 @@ assert_equal 'ok', %q{
|
|||
no_args
|
||||
splat_args
|
||||
}
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
class A
|
||||
private
|
||||
def foo = "ng"
|
||||
end
|
||||
|
||||
class B
|
||||
def initialize(o)
|
||||
@o = o
|
||||
end
|
||||
|
||||
def foo(...) = @o.foo(...)
|
||||
def internal_foo = foo
|
||||
end
|
||||
|
||||
b = B.new(A.new)
|
||||
|
||||
begin
|
||||
b.internal_foo
|
||||
rescue NoMethodError
|
||||
"ok"
|
||||
end
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue