Project

General

Profile

Bug #11571

シングルトンメソッドの中で def を使用した時の可視性が変わっている

Added by hsbt (Hiroshi SHIBATA) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-10-05 trunk 52041)
[ruby-dev:<unknown>]

Description

以下のコードの可視性が 2.3 と 2.2 で異なっているようです

https://github.com/radar/paranoia/blob/rails4/lib/paranoia.rb#L189

ruby 2.3.0dev (2015-10-05 trunk 52041) では private,
ruby 2.2.4p179 (2015-10-05 revision 52032) では public になります。

意図しない非互換な変更と思いますので修正をお願いします。


Related issues

Related to Ruby master - Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3AssignedActions

Associated revisions

Revision 25f5dd67
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52562
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

Revision 52562
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

Revision 52562
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

Revision 52562
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

Revision 52562
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

History

#1

Updated by ko1 (Koichi Sasada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset r52562.


  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

#2

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Related to Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3 added

Also available in: Atom PDF