[ruby-core:88689] [Ruby trunk Bug#14853] [BACKPORT] NameError#receiver at private constant returns a hidden object

From: usa@...
Date: 2018-08-27 13:48:57 UTC
List: ruby-core #88689
Issue #14853 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: DONE to 2.3: REQUIRED, 2.4: DONE, 2.5: DONE

ruby_2_4 r64559 merged revision(s) 63696.

----------------------------------------
Bug #14853: [BACKPORT] NameError#receiver at private constant returns a hidden object
https://bugs.ruby-lang.org/issues/14853#change-73746

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: r63695
* Backport: 2.3: REQUIRED, 2.4: DONE, 2.5: DONE
----------------------------------------
Fixed by r63696.

```ruby
module M
  X = 1
  private_constant :X
end
begin
  Module.new{include M}::X
rescue NameError => e
  e.receiver.object_id # undefined method `object_id' for #<M:0x000000010c5f7e88> (NoMethodError)
end
```

This is an `ICLASS` object which must not appear in the ruby level.



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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next