ruby-changes:54722
From: naruse <ko1@a...>
Date: Tue, 29 Jan 2019 13:39:38 +0900 (JST)
Subject: [ruby-changes:54722] naruse:r66939 (ruby_2_6): merge revision(s) 66938: [Backport #15488]
naruse 2019-01-29 13:39:32 +0900 (Tue, 29 Jan 2019) New Revision: 66939 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66939 Log: merge revision(s) 66938: [Backport #15488] Fix `Module#const_defined?` on inherited constants [Fix GH-2061] From: manga_osyo <manga.osyo@g...> Modified directories: branches/ruby_2_6/ Modified files: branches/ruby_2_6/object.c branches/ruby_2_6/test/ruby/test_module.rb branches/ruby_2_6/version.h Index: ruby_2_6/object.c =================================================================== --- ruby_2_6/object.c (revision 66938) +++ ruby_2_6/object.c (revision 66939) @@ -2688,7 +2688,6 @@ rb_mod_const_defined(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/ruby_2_6/object.c#L2688 return Qfalse; mod = rb_const_get_at(mod, id); } - recur = Qfalse; if (p < pend && !RB_TYPE_P(mod, T_MODULE) && !RB_TYPE_P(mod, T_CLASS)) { rb_raise(rb_eTypeError, "%"PRIsVALUE" does not refer to class/module", Index: ruby_2_6/version.h =================================================================== --- ruby_2_6/version.h (revision 66938) +++ ruby_2_6/version.h (revision 66939) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/version.h#L1 #define RUBY_VERSION "2.6.1" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 29 +#define RUBY_PATCHLEVEL 30 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 26 +#define RUBY_RELEASE_DAY 29 #include "ruby/version.h" Index: ruby_2_6/test/ruby/test_module.rb =================================================================== --- ruby_2_6/test/ruby/test_module.rb (revision 66938) +++ ruby_2_6/test/ruby/test_module.rb (revision 66939) @@ -338,6 +338,17 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_6/test/ruby/test_module.rb#L338 assert_raise(NameError) {self.class.const_defined?(const)} end + def test_nested_defined_inheritance + assert_send([Object, :const_defined?, [self.class.name, 'User', 'MIXIN'].join('::')]) + assert_send([self.class, :const_defined?, 'User::MIXIN']) + assert_send([Object, :const_defined?, 'File::SEEK_SET']) + + # const_defined? with `false` + assert_not_send([Object, :const_defined?, [self.class.name, 'User', 'MIXIN'].join('::'), false]) + assert_not_send([self.class, :const_defined?, 'User::MIXIN', false]) + assert_not_send([Object, :const_defined?, 'File::SEEK_SET', false]) + end + def test_nested_defined_bad_class assert_raise(TypeError) do self.class.const_defined?('User::USER::Foo') Index: ruby_2_6 =================================================================== --- ruby_2_6 (revision 66938) +++ ruby_2_6 (revision 66939) Property changes on: ruby_2_6 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66938 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/