mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 21:49:06 +02:00
merge revision(s) 63696: [Backport #14853]
variable.c: fix receiver on private constant * variable.c (rb_const_search): fix NameError :receiver attribute on private constant, should raise with the included module, not the ICLASS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d9572819b
commit
4941bba3c8
3 changed files with 40 additions and 5 deletions
|
@ -2304,6 +2304,7 @@ rb_const_search(VALUE klass, ID id, int exclude, int recurse, int visibility)
|
|||
|
||||
while ((ce = rb_const_lookup(tmp, id))) {
|
||||
if (visibility && RB_CONST_PRIVATE_P(ce)) {
|
||||
if (BUILTIN_TYPE(tmp) == T_ICLASS) tmp = RBASIC(tmp)->klass;
|
||||
rb_name_err_raise("private constant %2$s::%1$s referenced",
|
||||
tmp, ID2SYM(id));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue