ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120325] [Ruby master Bug#20970] `it /1/i` raises undefined method 'it' for main (NoMethodError) even if binding.local_variables includes `it`
@ 2024-12-19  8:59 tompng (tomoya ishida) via ruby-core
  2024-12-19 10:57 ` [ruby-core:120327] " zverok (Victor Shepelev) via ruby-core
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2024-12-19  8:59 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #20970 has been reported by tompng (tomoya ishida).

----------------------------------------
Bug #20970: `it /1/i` raises undefined method 'it' for main (NoMethodError) even if binding.local_variables includes `it`
https://bugs.ruby-lang.org/issues/20970

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-12-19T07:16:12Z master 335bba0fde) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
`it` parameter became a local variable with #20965, but it does not behave like local variable with `--parser=prism`

~~~ruby
i=2
42.tap do
  p it # 42
  p local_variables # [:it, :i]
  p it /1/i # should be 21, got NoMethodError
end
~~~


It prints `42`, `[:it, :i], `21` with `--parser=parse.y`




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2024-12-24 17:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19  8:59 [ruby-core:120325] [Ruby master Bug#20970] `it /1/i` raises undefined method 'it' for main (NoMethodError) even if binding.local_variables includes `it` tompng (tomoya ishida) via ruby-core
2024-12-19 10:57 ` [ruby-core:120327] " zverok (Victor Shepelev) via ruby-core
2024-12-19 17:17 ` [ruby-core:120330] " alanwu (Alan Wu) via ruby-core
2024-12-20  5:28 ` [ruby-core:120340] " tompng (tomoya ishida) via ruby-core
2024-12-20 18:16 ` [ruby-core:120348] " alanwu (Alan Wu) via ruby-core
2024-12-20 23:15 ` [ruby-core:120349] " k0kubun (Takashi Kokubun) via ruby-core
2024-12-21 18:47 ` [ruby-core:120356] " kddnewton (Kevin Newton) via ruby-core
2024-12-21 22:01 ` [ruby-core:120358] " k0kubun (Takashi Kokubun) via ruby-core
2024-12-23  4:51 ` [ruby-core:120370] " k0kubun (Takashi Kokubun) via ruby-core
2024-12-24 12:52 ` [ruby-core:120393] " Eregon (Benoit Daloze) via ruby-core
2024-12-24 17:32 ` [ruby-core:120398] " k0kubun (Takashi Kokubun) via ruby-core

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 NNTP newsgroup(s).