path: root/variable.c
diff options
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-19 08:15:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-19 08:15:52 (GMT)
commit1b474b869ccc3e93335e5b7ad01513d58f1fe1a3 (patch)
tree49762010329fab953fa6561020a14cfcf3e5e5e1 /variable.c
parentb3f56c6be05cf5f4a15c58d54aea49d780fcaa3c (diff)
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index cdc9efe..ee842e5 100644
--- a/variable.c
+++ b/variable.c
@@ -2362,6 +2362,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));