Project

General

Profile

Bug #12382

Deprecated constants will not print out warning when accessed directly

Added by rbjl (Jan Lelis) over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
[ruby-core:75505]

Description

Hi,

the current behavior of deprecate_constant is a little confusing:

module Namespace
  module Deprecated
  end

  deprecate_constant :Deprecated
end

puts "Referenced access:"
Namespace::Deprecated # warning: constant Namespace::Deprecated is deprecated

puts
puts "Direct access (from Object):"
include Namespace
Deprecated # warning: constant ::Deprecated is deprecated

puts
puts "Direct access (from inside namespace):"
module Namespace
  Deprecated # no warning
end

I would also expect a warning in the third case.

Associated revisions

Revision 5cb5692a
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

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

Revision 55005
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

Revision 55005
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

Revision 55005
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

Revision 55005
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

Revision 13f618f1
Added by nagachika (Tomoyuki Chikanaga) about 3 years ago

merge revision(s) 55005: [Backport #12382]

    * vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
      in the class context.  [ruby-core:75505] [Bug #12382]

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

Revision 55425
Added by nagachika (Tomoyuki Chikanaga) about 3 years ago

merge revision(s) 55005: [Backport #12382]

* vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
  in the class context.  [ruby-core:75505] [Bug #12382]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r55005.


vm_insnhelper.c: deprecated constant in class

  • vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382]

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Description updated (diff)
  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 3 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE

ruby_2_3 r55425 merged revision(s) 55005.

Also available in: Atom PDF