Colin Kelley
8ae24e6b08
[ruby/psych] issue #443 : quote Y and N when dumping
...
93c8fb443a
2024-01-17 00:45:06 +00:00
Hiroshi SHIBATA
4e2eca3be0
Extract base64 as bundled gems
2024-01-17 08:28:31 +09:00
Peter Zhu
07b9b53459
[PRISM] Fix crash with empty ensure blocks
...
Fixes ruby/prism#2179 .
2024-01-16 12:55:57 -05:00
Peter Zhu
1caa881a56
[PRISM] Fix splat assignment
...
Fixes ruby/prism#2177
2024-01-16 11:12:06 -05:00
TSUYUSATO Kitsune
c5e43da426
[ruby/prism] Correct the "ambiguous first argument" condition
...
Fix https://github.com/ruby/prism/pull/2182
This change reflects this line:
6283ae8d36/parse.y (L11124)
.
a52588ff37
2024-01-16 15:51:09 +00:00
Nobuyoshi Nakada
6283ae8d36
[ruby/stringio] Update the coderange after overwrite
...
Fix https://bugs.ruby-lang.org/issues/20185
8230552a46
2024-01-16 15:06:22 +00:00
tompng
ade56737e2
Fix coderange of invalid_encoding_string.<<(ord)
...
Appending valid encoding character can change coderange from invalid to valid.
Example: "\x95".force_encoding('sjis')<<0x5C will be a valid string "\x{955C}"
2024-01-16 23:18:55 +09:00
Peter Zhu
0520e9675b
[PRISM] Fix defined? for chained calls
...
Fixes ruby/prism#2148 .
2024-01-16 08:32:21 -05:00
Hiroshi SHIBATA
b68dab2d0f
Extract getoptlong as bundled gems
2024-01-16 17:07:10 +09:00
Nobuyoshi Nakada
0abbab9eb1
[Bug #20184 ] Test for low memory
2024-01-16 10:04:49 +09:00
Peter Zhu
6a175902f4
[PRISM] Fix keyword splat inside of array
...
Fixes ruby/prism#2155 .
2024-01-15 17:12:53 -05:00
Peter Zhu
7c6d7fbc28
[PRISM] Fix case without predicate
...
Fixes ruby/prism#2149 .
2024-01-15 09:58:44 -05:00
Samuel Giddins
e0312f90bb
[ruby/pp] Print beginless ranges properly
...
Instead of displaying the start of the range as nil
1df210d903
2024-01-15 14:04:14 +00:00
Samuel Williams
c5cf4d4e12
Improve behavioural consistency of unallocated (zero length) IO::Buffer
. ( #9532 )
...
This makes the behaviour of IO::Buffer.new(0) and IO::Buffer.new.slice(0, 0) consistent.
Fixes https://bugs.ruby-lang.org/issues/19542 and https://bugs.ruby-lang.org/issues/18805 .
2024-01-15 10:47:13 +13:00
Jeremy Evans
5c823aa686
Support keyword splatting nil
...
nil is treated similarly to the empty hash in this case, passing
no keywords and not calling any conversion methods.
Fixes [Bug #20064 ]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-01-14 11:41:02 -08:00
NAITOH Jun
338eb0065b
[ruby/strscan] StringScanner#captures: Return nil not "" for
...
unmached capture
(https://github.com/ruby/strscan/pull/72 )
fix https://github.com/ruby/strscan/issues/70
If there is no substring matching the group (s[3]), the behavior is
different.
If there is no substring matching the group, the corresponding element
(s[3]) should be nil.
```
s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
s.scan /(foo)(bar)(BAZ)?/ #=> "foobar"
s[0] #=> "foobar"
s[1] #=> "foo"
s[2] #=> "bar"
s[3] #=> nil
s.captures #=> ["foo", "bar", ""]
s.captures.compact #=> ["foo", "bar", ""]
```
```
s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
s.scan /(foo)(bar)(BAZ)?/ #=> "foobar"
s[0] #=> "foobar"
s[1] #=> "foo"
s[2] #=> "bar"
s[3] #=> nil
s.captures #=> ["foo", "bar", nil]
s.captures.compact #=> ["foo", "bar"]
```
https://docs.ruby-lang.org/ja/latest/method/MatchData/i/captures.html
```
/(foo)(bar)(BAZ)?/ =~ "foobarbaz" #=> 0
$~.to_a #=> ["foobar", "foo", "bar", nil]
$~.captures #=> ["foo", "bar", nil]
$~.captures.compact #=> ["foo", "bar"]
```
* StringScanner#captures is not yet documented.
https://docs.ruby-lang.org/ja/latest/class/StringScanner.html
1fbfdd3c6f
2024-01-14 22:27:24 +09:00
Nobuyoshi Nakada
4e5754a459
Add test for Errno
constants
2024-01-14 00:24:14 +09:00
Samuel Williams
f7178045bb
[ruby/openssl] Add support for gets(chomp: true)
.
...
8aa3849cff
2024-01-13 00:28:26 +00:00
Aaron Patterson
2c27a3a0dd
Fix splat assigns with no lefties
...
We still need to emit an expand array even if there's no "left side"
variables
Fixes: https://github.com/ruby/prism/issues/2153
2024-01-12 12:46:28 -08:00
Aaron Patterson
a0a100db49
Update test/ruby/test_compile_prism.rb
...
Co-authored-by: Ufuk Kayserilioglu <ufuk@paralaus.com>
2024-01-12 12:20:04 -08:00
Jemma Issroff
84f14ff089
[PRISM] Pre-concatenate Strings in InterpolatedStringNode
...
This commit concatenates String VALUEs within
InterpolatedStringNodes to allow us to preserve frozenness of
concatenated strings such as `"a""b"`
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2024-01-12 12:20:04 -08:00
Peter Zhu
0462b1b350
[PRISM] Fix splat in when
...
Fixes ruby/prism#2147 .
2024-01-12 13:04:23 -05:00
Kevin Newton
44d0c5ae3f
[PRISM] Raise syntax errors when found
2024-01-11 14:59:37 -05:00
Peter Zhu
45dd8edf82
[PRISM] Fix splat inside of aset
...
Fixes ruby/prism#2146 .
2024-01-11 14:58:24 -05:00
Aaron Patterson
f2149dc094
[PRISM] Support repeated required parameter names.
...
Fixes: https://github.com/ruby/prism/issues/2062
This patch only fixes positional parameters, we still need to fix the
other cases spelled out in test/prism/fixtures/repeat_parameters.txt
2024-01-11 11:31:59 -08:00
Kevin Newton
242dc537f9
[ruby/prism] Exclude encodings that are dynamic
...
6749146c0e
2024-01-11 19:14:25 +00:00
Benoit Daloze
4e0c2f05ef
[ruby/pp] Add TruffleRuby in CI
...
* Only 2 cyclic tests are failing, with the ... in a slightly different place in the output.
6e5c7d741e
2024-01-11 13:44:03 +00:00
Benoit Daloze
1ed3b60375
[ruby/pp] Fix pretty printing a Data subclass instance when the subclass is anonymous
...
* It would be "#<data a=42>" (double space) instead of "#<data a=42>" (like #inspect).
bed72bfcb8
2024-01-11 13:44:01 +00:00
Benoit Daloze
3b9cc22536
[ruby/pp] Use a proper feature check to check if Data is defined
...
ed602b9f2b
2024-01-11 13:44:00 +00:00
Nobuyoshi Nakada
3d3bc029c5
Reject encodings determined at runtime as source code encodings
...
The encodings determined at runtime are affected by the runtime
environment, such as the OS and locale, while the file contents are
not.
2024-01-11 18:46:51 +09:00
Nobuyoshi Nakada
d6741572ef
[ruby/rdoc] Undo accidentally deleted lines
...
4e14158255
2024-01-11 08:39:52 +00:00
Yusuke Endoh
78cd5b3657
Prevent syntax warnings in test/ruby/test_regexp.rb
2024-01-11 17:04:13 +09:00
Yusuke Endoh
60844ecf2e
Prevent a warning: ambiguous first argument
2024-01-11 17:03:22 +09:00
Nobuyoshi Nakada
7558625be1
[ruby/rdoc] Respect modeline to detect parser
...
485468f06f
2024-01-11 06:55:39 +00:00
David Rodríguez
0156b7416c
[rubygems/rubygems] Always avoid "Updating rubygems-update" message
...
The fact that under the hood the upgrade is done through a
rubygems-update gem is an implementation detail that does not really
help users to know.
Plus, it reads a bit weird.
0fa5c50258
2024-01-11 13:51:52 +09:00
David Rodríguez
3980cebda5
[rubygems/rubygems] Make gem update --system
respect ruby version constraints
...
36052abbe2
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
983ca8e9c9
[rubygems/rubygems] bin/rubocop -A --only Layout/SpaceBeforeFirstArg
...
cfcc33d480
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
888a8f4318
[rubygems/rubygems] bin/rubocop -A --only Style/StringLiteralsInInterpolation
...
2333f5f9c5
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
ea31461ba0
[rubygems/rubygems] bin/rubocop -A --only Style/StringLiterals
...
f25013bcc0
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
443e417885
[rubygems/rubygems] bin/rubocop -A --only Style/RedundantParentheses
...
7cc647c8f3
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
ff0119354e
[rubygems/rubygems] bin/rubocop -A --only Performance/StringInclude
...
34df962cf4
2024-01-11 13:51:52 +09:00
KJ Tsanaktsidis
76a8c963c7
Add a test for what happens with concurent calls to waitpid
...
Ruby 3.1 and 3.2 have a bug in their _implementation_, for which I'm
backporting a fix. However, the current development branch doesn't have
the issue (because the MJIT -> RJIT change refactored how waitpid worked
substantially). I do however want to commit the test which verifies
that waitpid works properly on master.
[Fixes #19387 ]
2024-01-11 13:12:17 +11:00
Hiroshi SHIBATA
27688b6a1d
[rubygems/rubygems] Update comment for minitest helper
...
77b0805474
2024-01-11 01:40:03 +00:00
Hiroshi SHIBATA
9f784915cd
[rubygems/rubygems] bin/rubocop -A test/rubygems/helper.rb
...
07ebc9f844
2024-01-11 01:40:02 +00:00
Hiroshi SHIBATA
bd9548810c
[rubygems/rubygems] Removed redundant block
...
d059b9ec4d
2024-01-11 01:40:01 +00:00
Jeremy Evans
ef75125271
Make defined? for op asgn expressions to constants use "assignment"
...
Previously, it used "expression", as that was the default. However,
op asgn expressions to constants use the NODE_OP_CDECL, so recognize
that node type as assignement.
Fixes [Bug #20111 ]
2024-01-10 16:02:38 -08:00
Kevin Newton
8333845b0b
[ruby/prism] Unary symbols that cannot be binary should drop @
...
d139af033f
2024-01-10 20:24:31 +00:00
Peter Zhu
51061b6631
[PRISM] Don't increment argc for PM_ASSOC_SPLAT_NODE
...
Fixes ruby/prism#2087 .
2024-01-10 13:32:19 -05:00
Peter Zhu
82b57d7bfe
Fix memory leak when duplicating too complex object
...
[Bug #20162 ]
Creating a ST table then calling st_replace leaks memory because the
st_replace overwrites the ST table without freeing any of the existing
memory. This commit changes it to use st_copy instead.
For example:
RubyVM::Shape.exhaust_shapes
o = Object.new
o.instance_variable_set(:@a, 0)
10.times do
100_000.times { o.dup }
puts `ps -o rss= -p #{$$}`
end
Before:
23264
33600
42672
52160
61600
71728
81056
90528
100560
109840
After:
14752
14816
15584
15584
15664
15664
15664
15664
15664
15664
2024-01-10 11:20:26 -05:00
Aaron Patterson
881c5a1846
[ruby/prism] Add a "repeated flag" to parameter nodes
...
It's possible to repeat parameters in method definitions like so:
```ruby
def foo(_a, _a)
end
```
The compiler needs to know to adjust the local table size to account for
these duplicate names. We'll use the repeated parameter flag to account
for the extra stack space required
b443cb1f60
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
2024-01-10 15:24:26 +00:00