ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:92832] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series
       [not found] <redmine.issue-15875.20190524225923@ruby-lang.org>
@ 2019-05-24 22:59 ` ronnie
  2019-05-24 23:02 ` [ruby-core:92833] " ronnie
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: ronnie @ 2019-05-24 22:59 UTC (permalink / raw)
  To: ruby-core

Issue #15875 has been reported by matsuda (Akira Matsuda).

----------------------------------------
Bug #15875: const_defined? behavior inconsistency in 2.6.x series
https://bugs.ruby-lang.org/issues/15875

* Author: matsuda (Akira Matsuda)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.1, 2.6.2, 2.6.3
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`Module#const_defined?` returns true for unreachable nested fully qualified module name.
Here are the results of `const_defined?` for each ruby version on my machine.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"

[1.9.3-p551, 2.0.0-p648]
-e:1:in `const_defined?': wrong constant name A::B (NameError)
	from -e:1:in `<main>'

[2.1.10, 2.2.10, 2.3.8, 2.4.6, 2.5.5, 2.6.0]
false

[2.6.1, 2.6.2, 2.6.3]
true

[2.7.0-dev (2019-05-25 trunk 559dca509d)]
false
```

For (2.6.1...2.6.3), it fails to reference the constant even though `const_defined?` returns true. So IMO this should be `const_defined?`'s bug.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B') && A::B"
-e:1:in `<main>': uninitialized constant A::B (NameError)
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:92833] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series
       [not found] <redmine.issue-15875.20190524225923@ruby-lang.org>
  2019-05-24 22:59 ` [ruby-core:92832] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series ronnie
@ 2019-05-24 23:02 ` ronnie
  2019-05-25  3:40 ` [ruby-core:92839] " merch-redmine
  2019-12-09 12:07 ` [ruby-core:96159] [Ruby master " nagachika00
  3 siblings, 0 replies; 4+ messages in thread
From: ronnie @ 2019-05-24 23:02 UTC (permalink / raw)
  To: ruby-core

Issue #15875 has been updated by matsuda (Akira Matsuda).


### Side Note #1

`const_get()` could get this constant for all released versions, but has been intentionally changed in 2.7. Correct?

```
% ruby -e "module A; end; B = 1; p Object.const_get('A::B')"

[1.9.3...2.6.3]
1

[2.7.0-dev (2019-05-25 trunk 559dca509d)]
Traceback (most recent call last):
	1: from -e:1:in `<main>'
-e:1:in `const_get': uninitialized constant A::B (NameError)

```


### Side Note #2

Current stable jruby seems to be following the 2.6 behavior.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"

[jruby-9.2.7.0]
true
```


----------------------------------------
Bug #15875: const_defined? behavior inconsistency in 2.6.x series
https://bugs.ruby-lang.org/issues/15875#change-78211

* Author: matsuda (Akira Matsuda)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.1, 2.6.2, 2.6.3
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`Module#const_defined?` returns true for unreachable nested fully qualified module name.
Here are the results of `const_defined?` for each ruby version on my machine.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"

[1.9.3-p551, 2.0.0-p648]
-e:1:in `const_defined?': wrong constant name A::B (NameError)
	from -e:1:in `<main>'

[2.1.10, 2.2.10, 2.3.8, 2.4.6, 2.5.5, 2.6.0]
false

[2.6.1, 2.6.2, 2.6.3]
true

[2.7.0-dev (2019-05-25 trunk 559dca509d)]
false
```

For (2.6.1...2.6.3), it fails to reference the constant even though `const_defined?` returns true. So IMO this should be `const_defined?`'s bug.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B') && A::B"
-e:1:in `<main>': uninitialized constant A::B (NameError)
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:92839] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series
       [not found] <redmine.issue-15875.20190524225923@ruby-lang.org>
  2019-05-24 22:59 ` [ruby-core:92832] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series ronnie
  2019-05-24 23:02 ` [ruby-core:92833] " ronnie
@ 2019-05-25  3:40 ` merch-redmine
  2019-12-09 12:07 ` [ruby-core:96159] [Ruby master " nagachika00
  3 siblings, 0 replies; 4+ messages in thread
From: merch-redmine @ 2019-05-25  3:40 UTC (permalink / raw)
  To: ruby-core

Issue #15875 has been updated by jeremyevans0 (Jeremy Evans).


Bisected to commit:bf8cc37b467e1d372e1b01b4d25e9ef6f8cc927f.

Backporting commit:d10451f3fd51f577e704db770de48d05044eb45c to 2.6 fixes this bug.

----------------------------------------
Bug #15875: const_defined? behavior inconsistency in 2.6.x series
https://bugs.ruby-lang.org/issues/15875#change-78218

* Author: matsuda (Akira Matsuda)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.1, 2.6.2, 2.6.3
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`Module#const_defined?` returns true for unreachable nested fully qualified module name.
Here are the results of `const_defined?` for each ruby version on my machine.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"

[1.9.3-p551, 2.0.0-p648]
-e:1:in `const_defined?': wrong constant name A::B (NameError)
	from -e:1:in `<main>'

[2.1.10, 2.2.10, 2.3.8, 2.4.6, 2.5.5, 2.6.0]
false

[2.6.1, 2.6.2, 2.6.3]
true

[2.7.0-dev (2019-05-25 trunk 559dca509d)]
false
```

For (2.6.1...2.6.3), it fails to reference the constant even though `const_defined?` returns true. So IMO this should be `const_defined?`'s bug.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B') && A::B"
-e:1:in `<main>': uninitialized constant A::B (NameError)
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:96159] [Ruby master Bug#15875] const_defined? behavior inconsistency in 2.6.x series
       [not found] <redmine.issue-15875.20190524225923@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-05-25  3:40 ` [ruby-core:92839] " merch-redmine
@ 2019-12-09 12:07 ` nagachika00
  3 siblings, 0 replies; 4+ messages in thread
From: nagachika00 @ 2019-12-09 12:07 UTC (permalink / raw)
  To: ruby-core

Issue #15875 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE

ruby_2_6 r67830 merged revision(s) e1b592b508c72a56ae012869d97fe1580ff87246,d10451f3fd51f577e704db770de48d05044eb45c.

----------------------------------------
Bug #15875: const_defined? behavior inconsistency in 2.6.x series
https://bugs.ruby-lang.org/issues/15875#change-83037

* Author: matsuda (Akira Matsuda)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.1, 2.6.2, 2.6.3
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
----------------------------------------
`Module#const_defined?` returns true for unreachable nested fully qualified module name.
Here are the results of `const_defined?` for each ruby version on my machine.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"

[1.9.3-p551, 2.0.0-p648]
-e:1:in `const_defined?': wrong constant name A::B (NameError)
	from -e:1:in `<main>'

[2.1.10, 2.2.10, 2.3.8, 2.4.6, 2.5.5, 2.6.0]
false

[2.6.1, 2.6.2, 2.6.3]
true

[2.7.0-dev (2019-05-25 trunk 559dca509d)]
false
```

For (2.6.1...2.6.3), it fails to reference the constant even though `const_defined?` returns true. So IMO this should be `const_defined?`'s bug.

```
% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B') && A::B"
-e:1:in `<main>': uninitialized constant A::B (NameError)
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-09 12:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15875.20190524225923@ruby-lang.org>
2019-05-24 22:59 ` [ruby-core:92832] [Ruby trunk Bug#15875] const_defined? behavior inconsistency in 2.6.x series ronnie
2019-05-24 23:02 ` [ruby-core:92833] " ronnie
2019-05-25  3:40 ` [ruby-core:92839] " merch-redmine
2019-12-09 12:07 ` [ruby-core:96159] [Ruby master " nagachika00

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).