ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants
@ 2020-04-06 20:02 mail
  2020-04-07  4:12 ` [ruby-core:97738] " sawadatsuyoshi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mail @ 2020-04-06 20:02 UTC (permalink / raw)
  To: ruby-core

Issue #16764 has been reported by exterm (Philip Müller).

----------------------------------------
Bug #16764: Module.const_source_location does not work on autoloaded constants
https://bugs.ruby-lang.org/issues/16764

* Author: exterm (Philip Müller)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants.

Example:

```
$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")
```

Returns `foo.rb:3`, when it should return `bar.rb:1`.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

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

* [ruby-core:97738] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants
  2020-04-06 20:02 [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants mail
@ 2020-04-07  4:12 ` sawadatsuyoshi
  2020-04-07 15:18 ` [ruby-core:97741] " nobu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sawadatsuyoshi @ 2020-04-07  4:12 UTC (permalink / raw)
  To: ruby-core

Issue #16764 has been updated by sawa (Tsuyoshi Sawada).


Read the documentation https://ruby-doc.org/core-2.7.0/Module.html#method-i-autoload:

>autoload(module, filename) → nilclick to toggle source
Registers filename to be loaded (using Kernel::require) the first time that module (which may be a String or a symbol) is accessed in the namespace of mod.

Your `foo.rb:1` registers the file to be read when a potential constant named `:Bar` is met. Your `foo.rb:3` calls a constant `Bar` for the first time, at which point the file `./bar` is read and `Bar` is defined.

----------------------------------------
Bug #16764: Module.const_source_location does not work on autoloaded constants
https://bugs.ruby-lang.org/issues/16764#change-84947

* Author: exterm (Philip Müller)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants.

Example:

```
$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")
```

Returns `foo.rb:3`, when it should return `bar.rb:1`.



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

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

* [ruby-core:97741] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants
  2020-04-06 20:02 [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants mail
  2020-04-07  4:12 ` [ruby-core:97738] " sawadatsuyoshi
@ 2020-04-07 15:18 ` nobu
  2020-07-23  8:47 ` [ruby-core:99296] " nagachika00
  2021-04-04 22:42 ` [ruby-core:103214] " usa
  3 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2020-04-07 15:18 UTC (permalink / raw)
  To: ruby-core

Issue #16764 has been updated by nobu (Nobuyoshi Nakada).

Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED

Prior to 2.6 don't have `Module#const_source_location`, but redefinition warning message has this location.

----------------------------------------
Bug #16764: Module.const_source_location does not work on autoloaded constants
https://bugs.ruby-lang.org/issues/16764#change-84950

* Author: exterm (Philip Müller)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED
----------------------------------------
As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants.

Example:

```
$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")
```

Returns `foo.rb:3`, when it should return `bar.rb:1`.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

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

* [ruby-core:99296] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants
  2020-04-06 20:02 [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants mail
  2020-04-07  4:12 ` [ruby-core:97738] " sawadatsuyoshi
  2020-04-07 15:18 ` [ruby-core:97741] " nobu
@ 2020-07-23  8:47 ` nagachika00
  2021-04-04 22:42 ` [ruby-core:103214] " usa
  3 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2020-07-23  8:47 UTC (permalink / raw)
  To: ruby-core

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

Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE

ruby_2_7 c65aae118ccff86096b9983641b371491bc23434 merged revision(s) 927308108cced69cae478798004524b9a5d2f252.

----------------------------------------
Bug #16764: Module.const_source_location does not work on autoloaded constants
https://bugs.ruby-lang.org/issues/16764#change-86685

* Author: exterm (Philip Müller)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE
----------------------------------------
As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants.

Example:

```
$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")
```

Returns `foo.rb:3`, when it should return `bar.rb:1`.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

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

* [ruby-core:103214] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants
  2020-04-06 20:02 [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants mail
                   ` (2 preceding siblings ...)
  2020-07-23  8:47 ` [ruby-core:99296] " nagachika00
@ 2021-04-04 22:42 ` usa
  3 siblings, 0 replies; 5+ messages in thread
From: usa @ 2021-04-04 22:42 UTC (permalink / raw)
  To: ruby-core

Issue #16764 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE

bacported into ruby_2_6 at r16764

----------------------------------------
Bug #16764: Module.const_source_location does not work on autoloaded constants
https://bugs.ruby-lang.org/issues/16764#change-91289

* Author: exterm (Philip Müller)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
----------------------------------------
As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants.

Example:

```
$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")
```

Returns `foo.rb:3`, when it should return `bar.rb:1`.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

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

end of thread, other threads:[~2021-04-04 22:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 20:02 [ruby-core:97733] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants mail
2020-04-07  4:12 ` [ruby-core:97738] " sawadatsuyoshi
2020-04-07 15:18 ` [ruby-core:97741] " nobu
2020-07-23  8:47 ` [ruby-core:99296] " nagachika00
2021-04-04 22:42 ` [ruby-core:103214] " usa

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