diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-02 08:53:52 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-02 08:53:52 +0000 |
commit | 4a625f839ccd9f226fcef95499c4b48702cc0b69 (patch) | |
tree | 1e809d21e4bd4dc0af7da72cce29129c83b90f86 /variable.c | |
parent | bb8532946030cb2e4337bd4f1f462e19ee507fa1 (diff) |
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_5@63825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/variable.c b/variable.c index 53ad84f214..f700303d2f 100644 --- a/variable.c +++ b/variable.c @@ -2257,6 +2257,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)); } |