ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:51033] [Ruby master Bug#17764] ブロック付きメソッドにおけるproc(または Proc.new)の参照がArgumentErrorを吐く問題
@ 2021-03-31  0:41 firelzrd
  2021-03-31  0:56 ` [ruby-dev:51034] " manga.osyo
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: firelzrd @ 2021-03-31  0:41 UTC (permalink / raw)
  To: ruby-dev

Issue #17764 has been reported by firelzrd (Masahito Suzuki).

----------------------------------------
Bug #17764: ブロック付きメソッドにおけるproc(または Proc.new)の参照がArgumentErrorを吐く問題
https://bugs.ruby-lang.org/issues/17764

* Author: firelzrd (Masahito Suzuki)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
# ブロック付きメソッドにおけるproc(または Proc.new)の参照がArgumentErrorを吐く問題
# Ruby 3.0.0 linux x86-64およびWindows上のmingw-x86-64バイナリにて発生し、2.7.2-1ではいずれも発生しないことを確認済み。
# また、2021/3/31現在、TryRubyサイト( https://try.ruby-lang.org/ ) の上でも発生することを確認済み。

def foo
  puts (block_given? ? proc : proc{"ブロックなし"}).call
end

# @ruby 3.0.0
foo #ブロックなし => "ブロックなし"
foo{"ブロックあり"} #ブロックあり => ArgumentError: tried to create Proc object without a block

# @ruby 2.7.2
foo #ブロックなし => "ブロックなし"
foo{"ブロックあり"} #ブロックあり => "ブロックあり"


---Files--------------------------------
argumenterror.png (125 KB)


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

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

end of thread, other threads:[~2021-03-31  3:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  0:41 [ruby-dev:51033] [Ruby master Bug#17764] ブロック付きメソッドにおけるproc(または Proc.new)の参照がArgumentErrorを吐く問題 firelzrd
2021-03-31  0:56 ` [ruby-dev:51034] " manga.osyo
2021-03-31  2:30 ` [ruby-dev:51036] " firelzrd
2021-03-31  2:35 ` [ruby-dev:51037] " ko1
2021-03-31  2:57 ` [ruby-dev:51038] " firelzrd
2021-03-31  3:04 ` [ruby-dev:51039] " manga.osyo
2021-03-31  3:05 ` [ruby-dev:51040] " matz
2021-03-31  3:13 ` [ruby-dev:51041] " firelzrd

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