ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: ko1@atdot.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94211] [Ruby master Bug#15877] Incorrect constant lookup result in method on cloned class
Date: Fri, 09 Aug 2019 02:13:25 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-80509.20190809021322.6b445403407b7ee5@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15877.20190526095912@ruby-lang.org

Issue #15877 has been updated by ko1 (Koichi Sasada).


> solve "duplicate :raise event" [Bug #15877]


sorry my mistake :p

----------------------------------------
Bug #15877: Incorrect constant lookup result in method on cloned class
https://bugs.ruby-lang.org/issues/15877#change-80509

* Author: danielwaterworth (Daniel Waterworth)
* Status: Closed
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version: 
* ruby -v: 2.6.3
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: REQUIRED
----------------------------------------
This behavior seems wrong to me:

``` ruby
class Foo
  def test
    TEST
  end
end

Bar1 = Foo.clone
Bar2 = Foo.clone

class Bar1
  TEST = 'bar-1'
end

class Bar2
  TEST = 'bar-2'
end

# If these two lines are reordered, 'bar-2' is produced each time
p [:bar1_method, Bar1.new.test] # outputs 'bar-1' (correct)
p [:bar2_method, Bar2.new.test] # outputs 'bar-1' (incorrect)

p [:bar1_const, Bar1::TEST] # outputs 'bar-1' (correct)
p [:bar2_const, Bar2::TEST] # outputs 'bar-2' (correct)
```

Possibly related to #9603, #7107



-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2019-08-09  2:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15877.20190526095912@ruby-lang.org>
2019-05-26  9:59 ` [ruby-core:92849] [Ruby trunk Bug#15877] Incorrect constant lookup result in method on cloned class daniel
2019-05-26 13:31 ` [ruby-core:92850] " daniel
2019-05-27 21:01 ` [ruby-core:92867] " stephen.gregory
2019-07-29  7:30 ` [ruby-core:93973] [Ruby master " ko1
2019-08-08  9:46 ` [ruby-core:94197] " nagachika00
2019-08-08 13:30 ` [ruby-core:94199] " nobu
2019-08-09  2:13 ` ko1 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-80509.20190809021322.6b445403407b7ee5@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).