diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 13:48:53 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 13:48:53 +0000 |
commit | 4941bba3c8b5eda08691ebcb14930659897b997c (patch) | |
tree | 8a193c122448d7af1d66b4534a31817d57536a15 /variable.c | |
parent | 7d9572819bfd3932f206549576fbf931551947a6 (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_4@64559 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 b1080d44ab..77d246d728 100644 --- a/variable.c +++ b/variable.c @@ -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)); } |