| Age | Commit message (Collapse) | Author |
|
|
|
|
|
* Consistent with plain `blocks` and `for` blocks and methods
where the source_location covers their entire definition.
* Matches the documentation which mentions
"where the definition starts/ends".
* Partially reverts d357d50f0a74409446f4cccec78593373f5adf2f
which was a workaround to be compatible with parse.y.
|
|
* This reverts commit 065c48cdf11a1c4cece84db44ed8624d294f8fd5.
* This functionality is very valuable and has already taken 14 years
to agree on the API.
* Let's just document it's byte columns (in the next commit).
* See https://bugs.ruby-lang.org/issues/21783#note-9
|
|
and columns"
This reverts commit 073c4e1cc712064e626914fa4a5a8061f903a637.
https://bugs.ruby-lang.org/issues/6012#note-31
> we will cancel this feature in 4.0 because of design ambiguities
> such as whether to return column positions in bytes or characters as
> in [#21783].
[#21783]: https://bugs.ruby-lang.org/issues/21783
|
|
|
|
|
|
Previously, ruby2_keywords could be used on a method or proc with
post arguments, but I don't think the behavior is desired:
```ruby
def a(*c, **kw) [c, kw] end
def b(*a, b) a(*a, b) end
ruby2_keywords(:b)
b({foo: 1}, bar: 1)
```
This changes ruby2_keywords to emit a warning and not set the
flag on a method/proc with post arguments.
While here, fix the ruby2_keywords specs for warnings, since they
weren't testing what they should be testing. They all warned
because the method didn't accept a rest argument, not because it
accepted a keyword or keyword rest argument.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13265
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12984
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12679
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12539
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12517
|
|
|
|
|
|
|
|
[Bug #20253]
All the way down to Ruby 1.9, `Proc`, `Method`, `UnboundMethod`
and `Binding` always had their own specific clone and dup routine.
This caused various discrepancies with how other objects behave
on `dup` and `clone. [Bug #20250], [Bug #20253].
This commit get rid of `CLONESETUP` and use the the same codepath
as all other types, so ensure consistency.
NB: It's still not accepting the `freeze` keyword argument on `clone`.
Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
|
|
|
|
|
|
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.
Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.
[Feature #19777]
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/8405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lambda
This makes it easier to use Proc#parameters to build wrappers.
Implements [Feature #15357]
Notes:
Merged: https://github.com/ruby/ruby/pull/5677
|
|
|
|
|
|
Because https://github.com/ruby/ruby/pull/5148 merged after Ruby 3.1.0 released.
13241b71a50dded0a7b021ec4f2fb6a995daace9 did not fix proc spec yet.
https://github.com/ruby/actions/runs/4718820699?check_suite_focus=true#step:18:173
```
1)
Proc#parameters adds * rest arg for "star" argument FAILED
Expected [[:req, :x], [:rest]] == [[:req, :x], [:rest, :*]]
to be truthy but was false
/home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:85:in `block (3 levels) in <top (required)>'
/home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:3:in `<top (required)>'
```
|
|
This allows for the following syntax:
```ruby
def foo(*)
bar(*)
end
def baz(**)
quux(**)
end
```
This is a natural addition after the introduction of anonymous
block forwarding. Anonymous rest and keyword rest arguments were
already supported in method parameters, this just allows them to
be used as arguments to other methods. The same advantages of
anonymous block forwarding apply to rest and keyword rest argument
forwarding.
This has some minor changes to #parameters output. Now, instead
of `[:rest], [:keyrest]`, you get `[:rest, :*], [:keyrest, :**]`.
These were already used for `...` forwarding, so I think it makes
it more consistent to include them in other cases. If we want to
use `[:rest], [:keyrest]` in both cases, that is also possible.
I don't think the previous behavior of `[:rest], [:keyrest]` in
the non-... case and `[:rest, :*], [:keyrest, :**]` in the ...
case makes sense, but if we did want that behavior, we'll have to
make more substantial changes, such as using a different ID in the
... forwarding case.
Implements [Feature #18351]
Notes:
Merged: https://github.com/ruby/ruby/pull/5148
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Previously, these were not implemented, and Object#== and #eql?
were used. This tries to check the proc internals to make sure
that procs created from separate blocks are treated as not equal,
but procs created from the same block are treated as equal, even
when the lazy proc allocation optimization is used.
Implements [Feature #14267]
Notes:
Merged: https://github.com/ruby/ruby/pull/3174
|
|
|
|
The warning for these was added in 2.7.
Notes:
Merged: https://github.com/ruby/ruby/pull/3208
|
|
|
|
|
|
[Bug #16406]
|
|
|
|
|
|
Now Proc#to_s returns
"#<Proc:0x00000237a0f5f170@t.rb:1>".
However, it is convenient to select a file name by (double-)clicking
on some terminals by separating ' ' instead of '@' like
"#<Proc:0x00000237a0f5f170 t.rb:1>"
[Feature #16101]
|
|
|
|
|
|
|