Actions
Feature #17361
closedlambda(&block) does not warn with lazy proc allocation
Description
In NEWS,
* Kernel#lambda now warns if called without a literal block.
[[Feature #15973]]
But the following code from https://docs.ruby-lang.org/ja/latest/method/Kernel/m/lambda.html (https://github.com/rurema/doctree/blob/495868c466c97c9bcca28d64d6ce0d68350de3e2/refm/api/src/_builtin/functions#L2436-L2441) does not warn.
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
Once block assign to a local variable, it warns.
def foo &block
b = block
lambda(&b)
end
it = foo{p 12}
it.call #=> 12
Actions
Like0
Like0Like0Like0