Actions
Bug #20342
closedTop level `public`, `private` and `ruby2_keywords` do not work in wrapped load
Description
With this file:
# load.rb
public def f = :ok
It is OK when require
d.
$ ruby -r ./load.rb -e 'p f'
:ok
Simple load
is OK too.
$ ruby -e 'load ARGV[0]; p f' load.rb
:ok
Wrapped load
fails.
$ ruby -e 'load ARGV[0], true' load.rb
load.rb:1:in 'public': undefined method 'f' for class 'Object' (NameError)
public def f = :ok
^^^^^^
from load.rb:1:in '<top (required)>'
from -e:1:in 'Kernel#load'
from -e:1:in '<main>'
Updated by nobu (Nobuyoshi Nakada) 8 months ago
https://github.com/ruby/ruby/pull/10271
I'm not sure these methods should print the warning too.
Updated by nobu (Nobuyoshi Nakada) 8 months ago
- Status changed from Open to Closed
Applied in changeset git|58918788abd63901588e4aa1e39b5c057321c10a.
[Bug #20342] Consider wrapped load in main
methods
Updated by k0kubun (Takashi Kokubun) 6 months ago
- Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE
ruby_3_3 a24f19742bfa398a3b32c51df01133db7bcbc6e0 merged revision(s) 58918788abd63901588e4aa1e39b5c057321c10a.
Updated by nagachika (Tomoyuki Chikanaga) 4 months ago
- Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
ruby_3_2 b72deb7ca1198f8c799cd5e7e44635cf50abd7ec merged revision(s) 58918788abd63901588e4aa1e39b5c057321c10a.
Actions
Like0
Like0Like0Like0Like0