Age | Commit message (Collapse) | Author |
|
2bc293e899c9d32dcd794a73de8925c49ecf8f15,d0e6c6e682b9ba2b0309a5177933a0628e8ef316,cc0dc67bbbe1951ff90004bc987f78545625d772,e1eff837cf12a8e813de9d4ff2db50c9b68b86b5,0ab0b86c8491d639b9ff1335ddf35e341ecd867e,6911b4bc82889860ff7da4ecf975504cdc3e5314: [Backport #17854]
cdhash_cmp: can take rational literals
Rational literals are those integers suffixed with `r`. They tend to
be a part of more complex expressions like `123/456r`, but in theory
they can live alone. When such "bare" rational literals are passed to
case-when branch, we have to take care of them. Fixes [Bug #17854]
---
common.mk | 1 +
compile.c | 7 +++++++
internal/rational.h | 1 +
rational.c | 13 ++++++++++---
test/ruby/test_rational.rb | 7 +++++++
5 files changed, 26 insertions(+), 3 deletions(-)
cdhash_cmp: rational literals with fractions
Nobu kindly pointed out that rational literals can have fractions.
---
compile.c | 5 +++--
test/ruby/test_rational.rb | 4 ++++
2 files changed, 7 insertions(+), 2 deletions(-)
cdhash_cmp: can also take complex
There are complex literals `123i`, which can also be a case condition.
---
compile.c | 15 +++++++++++----
complex.c | 12 +++++++++---
internal/complex.h | 1 +
test/ruby/test_rational.rb | 4 ++++
4 files changed, 25 insertions(+), 7 deletions(-)
cdhash_cmp: recursively apply
For instance a rational's numerator can be a bignum. Comparison using
C's == can be insufficient.
---
compile.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
cdhash_cmp: should use ||
cf: https://github.com/ruby/ruby/pull/4469#discussion_r628386707
---
compile.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
test_cdhash: refactor change class
It is now strange to test Complex in a class named Rational_Test.
---
test/ruby/test_rational.rb | 15 ---------------
test/ruby/test_syntax.rb | 15 +++++++++++++++
2 files changed, 15 insertions(+), 15 deletions(-)
|
|
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3704
|
|
[Feature #17260] One-line pattern matching using tASSOC
R-assignment is rejected instead.
Notes:
Merged-By: nobu <nobu@ruby-lang.org>
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3445
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3445
|
|
Also unwrap NODE_RIPPER to check the method name.
Notes:
Merged: https://github.com/ruby/ruby/pull/3649
|
|
https://bugs.ruby-lang.org/issues/16746#note-26
Notes:
Merged: https://github.com/ruby/ruby/pull/3479
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3163
|
|
|
|
The idFWD_KWREST sections may be wrong. However, the existing
idFWD_KWREST sections for ... without leading arguments are already
broken.
Implements [Feature #16378]
Notes:
Merged: https://github.com/ruby/ruby/pull/3190
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3112
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3108
|
|
Even for empty argument list, not to be confusing with a writer
method name.
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
This reverts commit 67bcac879a2e0ddfb4e7bbd7cb5e5401422de76a.
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3025
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2996
|
|
[Feature #15921]
Notes:
Merged: https://github.com/ruby/ruby/pull/3012
|
|
Previously, method call keyword splats and hash keyword splats
were compiled exactly the same. This is because parse-wise, they
operate on indentical nodes when it comes to compiling the **{}.
Fix this by using an ugly hack of temporarily modifying the
nd_brace flag in the method call keyword splat case. Inside
compile_hash, only optimize the **{} case for hashes where the
nd_brace flag has been modified to reflect we are in the method
call keyword splat case and it is safe to do so.
Since compile_keyword_args is only called in one place, move the
keyword_node_p call out of that method to the single caller to
avoid duplicating the code.
Notes:
Merged: https://github.com/ruby/ruby/pull/2945
|
|
|
|
[Feature #16432]
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2794
|
|
warnings
|
|
(old)
test.rb:4: warning: The last argument is used as the keyword parameter
test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?
(new)
test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call
test.rb:1: warning: The called method `foo' is defined here
|
|
[Bug #16438]
|
|
[Bug #16438]
|
|
|
|
[Feature #16433]
|
|
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
|
|
|
|
|
|
This reverts commit 69ec3f70fab0c1c537c68fb135cc315181b1d750.
|
|
This reverts commit 6eaac7cfac668d6669be694fd7b723c4982ed218.
|
|
|
|
|
|
|
|
|
|
|
|
Get rid of these redundant and useless warnings.
```
$ ruby -e 'def bar(a) a; end; def foo(...) bar(...) end; foo({})'
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here
-e:1: warning: The keyword argument is passed as the last hash parameter
-e:1: warning: for `bar' defined here
```
|
|
|
|
|
|
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2575
|