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:
Aaron Patterson 2025-03-21 09:19:42 -07:00
parent 93ac342afc
commit 595040ba27
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 26 additions and 1 deletions

View file

@ -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
}