Граф коммитов

19276 Коммитов

Автор SHA1 Сообщение Дата
Étienne Barrié 1376881e9a Stop marking chilled strings as frozen
They were initially made frozen to avoid false positives for cases such
as:

    str = str.dup if str.frozen?

But this may cause bugs and is generally confusing for users.

[Feature #20205]

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-05-28 07:32:33 +02:00
Yusuke Endoh 2114d0af1e Make test_nested_timeouts less flaky
This test randomly fails due to the bug reported in [Bug #20314], where
the two timeouts are too close so that they can expire at the same time.

As a workaround, this change increases the time difference between
timeouts. This will reduce the probability of simultaneous expirations
and lower flakiness.
2024-05-28 12:49:46 +09:00
verdy89 7c6e4bc7ca [ruby/reline] Implement the redo command
(https://github.com/ruby/reline/pull/707)

* Implement the redo command

* Commented out a test that does not pass

* Changed key assignment for redo from "\C-[" to "\C-g"

* Changed redo key assignment from `\C-g` to `\M-\C-_`

* Revert the first implemantation

* Implemented redo by sharing `@past_lines` between undo and redo

* Fixed the index of past_lines that is updated when the cursor is moved

* Fixed deletion of the redo history in regular input

* Renamed variables: past_lines -> input_lines

* Rename @position to @input_lines_position

* Deleted unused variables: `@old_byte_pointer` and `@old_line_index`

https://github.com/ruby/reline/commit/0b2d9fab5f
2024-05-27 16:38:22 +00:00
Yusuke Endoh bc47ca5546 Add a debug print for a random failure
```
  1) Error:
TestRubyLiteral#test_float:
ArgumentError: SyntaxError#path changed: "(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)"->"(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)"
```
https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20240527T050036Z.fail.html.gz
2024-05-27 18:16:28 +09:00
Nobuyoshi Nakada bc50f2a3f1
Debug unexpectedly changed path 2024-05-26 20:14:18 +09:00
Go 508f331048 [ruby/reline] allow space in config value
(https://github.com/ruby/reline/pull/705)

* allow space in config value

fix https://github.com/ruby/reline/pull/657

* remove inline comments

* Revert "remove inline comments"

This reverts commit https://github.com/ruby/reline/commit/2438347c1a10.

* refactoring

* remove unnecessary comment handling

https://github.com/ruby/reline/commit/d60f1e1e39
2024-05-26 08:28:25 +00:00
Nobuyoshi Nakada 0bae2f0002
[Bug #20510] Do not count optional hash argument for `IO.new`
Since `IO.new` accepts one or two positional arguments except for the
optional hash argument, exclude the optional hash argument from the
check for delegation to `IO.new`.
2024-05-25 19:15:25 +09:00
Kevin Newton c7281e2d67 [ruby/prism] Fix up ruby_parser string concat
https://github.com/ruby/prism/commit/4b06eae0df
2024-05-24 19:27:44 +00:00
Kevin Newton f8b750370e [ruby/prism] Remove Debug module
https://github.com/ruby/prism/commit/4d8929ff6a
2024-05-24 17:19:38 +00:00
Kevin Newton 79001c8b4a [ruby/prism] Remove error formatting, put directly in CRuby
https://github.com/ruby/prism/commit/53b2866487
2024-05-24 17:19:36 +00:00
Kevin Newton 653652bcbe [ruby/prism] Remove Debug#named_captures
https://github.com/ruby/prism/commit/5050dfbe70
2024-05-24 17:19:35 +00:00
Kevin Newton b04c959621 [ruby/prism] Remove various unused memsize infra
https://github.com/ruby/prism/commit/283938ed1f
2024-05-24 17:19:34 +00:00
Kevin Newton b8681c2e37 [ruby/prism] Remove Debug::integer_parse
https://github.com/ruby/prism/commit/14e397598b
2024-05-24 17:19:33 +00:00
Kevin Newton 870350253e [ruby/prism] Remove Debug::static_inspect
https://github.com/ruby/prism/commit/486c71c426
2024-05-24 17:19:33 +00:00
Kevin Newton 47f0965269 Update duplicated when clause warning message 2024-05-24 12:36:54 -04:00
Kevin Newton 7021e15652 [ruby/prism] Update duplicated when error message
https://github.com/ruby/prism/commit/54316fd8a0
2024-05-24 12:36:54 -04:00
Kevin Newton 2d4d99f78a [PRISM] Update remaining test excludes 2024-05-23 21:27:36 -04:00
eileencodes c96b5791ef [ruby/prism] Raise `void value expression` in begin clauses
In some cases Prism was either not raising an appropriate `void value
expression` error, or raising that error when the syntax is considered
valid.

To fix this Prism needs to check whether we have other clauses on the
`begin` rather than just returning `cast->statements`.

* If the `cast->statements` are null and the `cast->ensure_clause` is
not null, set the code to `cast->ensure_clause`
* else
  * If there is a `cast->rescue_clause`
    * Check if `cast->statements` are null and `cast->rescue_clause->statements`
    are null, and return `NULL`
    * Check if there is an `else_clause`, and set the node to
      `cast->else_clause`.
    * Otherwise return `cast->statements` as the node
  * return `cast->statements` as the node

See tests for test cases. Note I took these directly from CRuby so if
desired I can delete them since the test will now pass. This only fixes
one test in the `test_parse` file, taking failures from 14 to 13.

This fixes `TestParse#test_void_value_in_rhs` and is related to
issue #2791.

https://github.com/ruby/prism/commit/398152b412
2024-05-23 19:30:03 +00:00
Nobuyoshi Nakada 49fcd33e13 Introduce a specialize instruction for Array#pack
Instructions for this code:

```ruby
  # frozen_string_literal: true

[a].pack("C")
```

Before this commit:

```
== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(3,13)>
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 newarray                               1
0005 putobject                              "C"
0007 opt_send_without_block                 <calldata!mid:pack, argc:1, ARGS_SIMPLE>
0009 leave
```

After this commit:

```
== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(3,13)>
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject                              "C"
0005 opt_newarray_send                      2, :pack
0008 leave
```

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2024-05-23 12:11:50 -07:00
Kevin Newton 56a51fcd33 [PRISM] Fix up some masgn topn calculations 2024-05-23 13:22:22 -04:00
Kevin Newton 0ebd37234e [PRISM] Enable TestSyntax#test_unterminated_heredoc_cr 2024-05-23 12:41:22 -04:00
Kevin Newton 6d81ae3f01 [PRISM] Properly support 'it' 2024-05-22 16:34:04 -04:00
Kevin Newton e575954887 [ruby/prism] Fix support for 'it' implicit local variable
https://github.com/ruby/prism/commit/53bbcfe513
2024-05-22 16:34:04 -04:00
Kevin Newton b20adf90e3 [ruby/prism] Fix up ruby_parser interpolation concatenation
https://github.com/ruby/prism/commit/79cec4be22
2024-05-21 18:45:16 +00:00
Kevin Newton 89efb94fec [ruby/prism] Reconfigure rationals
This eliminates the subnode on RationalNode and replaces it with two
integer fields, which represent the ratio for the rational. It also
reduces those two integers if they both fit into 32 bits.

Importantly, this PR does not implement bignum reduction. That's something
I'd like to consider for the future, but it's simple enough for now to
leave them unreduced, which makes it more useful than it used to be.

https://github.com/ruby/prism/commit/86e06c7068
2024-05-21 14:27:46 -04:00
Kevin Newton 16b0bb3d53 [PRISM] Enable TestSyntax#test_warn_balanced 2024-05-21 14:27:28 -04:00
Kevin Newton bcbfc675a4 [PRISM] Enable TestSyntax#test_numbered_parameter 2024-05-21 12:56:20 -04:00
Kevin Newton ff43b4a28b [ruby/prism] Add error for numbered parameter used in inner block
https://github.com/ruby/prism/commit/c386ba6d48
2024-05-21 15:46:45 +00:00
Kevin Newton 6ddc0a8044 [PRISM] Enable TestRegexp#test_unescape 2024-05-20 21:25:51 -04:00
Kevin Newton e82c7a0577 [PRISM] Enable TestRegexp#test_match_control_meta_escape 2024-05-20 21:25:51 -04:00
Jeremy Evans 86cf074fa1 Avoid array allocation for empty ruby2_keywords flagged keyword hash
If the method being called does not have a positional splat
parameter, there is no point in allocating the array, as
decrementing given_argc is sufficient to ensure the empty keyword
hash is not considered an argument, assuming that we are calling
a method/lambda and not a regular proc.
2024-05-21 05:33:57 +09:00
Jeremy Evans 2433b57b6a Avoid hash allocation for empty ruby2_keywords flagged keyword hash
If the method being called does not have a keyword splat parameter,
there is no point in allocating the hash, because the hash will
be unused (as empty keyword hashes are ignored).
2024-05-21 05:33:57 +09:00
Jeremy Evans f021bcdbbe Add allocation tests for ruby2_keywords
This tests ruby2_keywords flagged methods, as well as passing
ruby2_keywords flagged hashes to other methods.

Some of the behavior here is questionable, such as allocating
different numbers of objects depending on whether a block is
passed or whether YJIT is enabled. I think there are likely ways
to eliminate allocations in certain cases.  However, this gives
us a baseline and shows us where it is possible to make
improvements.
2024-05-21 05:33:57 +09:00
Kevin Newton 78e504f21d [PRISM] Enable TestPrism#test_truncated_source_line 2024-05-20 12:28:37 -04:00
Kevin Newton ca5b458044 [PRISM] Match CRuby line semantics for evstr 2024-05-20 11:28:53 -04:00
Kevin Newton 785fba3b16 [PRISM] Enable TestSyntax#test_warn_balanced 2024-05-20 10:49:41 -04:00
Kevin Newton e90e8f8bd3 [ruby/prism] Implement ambiguous binary operator warning
https://github.com/ruby/prism/commit/6258c3695f
2024-05-20 14:01:05 +00:00
Jean Boussier 0b38403328 Fix incorrect assertion in TestThreadInstrumentation
The test meant to assert the thread is suspended at least once,
but was actually asserting to it to be suspected at least twice.
2024-05-20 14:59:59 +09:00
Yusuke Endoh eb410c9fde [ruby/error_highlight] Load "did_you_mean" explicitly in test
I'm not sure how it works, but I seem to get an error
`undefined method 'formatter' for module DidYouMean` in parallel mode of
`make test-all`.

https://app.launchableinc.com/organizations/ruby/workspaces/ruby/data/test-paths/file%3Dtest%2Ferror_highlight%2Ftest_error_highlight.rb%23class%3DErrorHighlightTest%23testcase%3Dtest_explicit_raise_name_error?organizationId=ruby&workspaceId=ruby&testPathId=file%3Dtest%2Ferror_highlight%2Ftest_error_highlight.rb%23class%3DErrorHighlightTest%23testcase%3Dtest_explicit_raise_name_error&testSessionStatus=flake

https://github.com/ruby/error_highlight/commit/f931b42430
2024-05-20 03:47:22 +00:00
Nobuyoshi Nakada a10a483af9 [rubygems/rubygems] Should rescue vendored net-http exception
https://github.com/rubygems/rubygems/commit/7d2c4cf364
2024-05-20 01:35:58 +00:00
Kevin Newton cce7c25a42 [PRISM] Enable TestRequire 2024-05-17 16:42:14 -04:00
Kevin Newton e61d24d77e [PRISM] Enable passing IRB test 2024-05-17 11:29:00 -04:00
Kevin Newton 4ba0579da6 [PRISM] Enable TestSyntax#test_error_message_encoding 2024-05-17 10:33:42 -04:00
Kevin Newton 761b907024 [PRISM] Enable TestParse#test_truncated_source_line 2024-05-16 22:13:10 -04:00
Kevin Newton 854cbbd5a9 [PRISM] Enable TestParse#test_string 2024-05-16 15:35:22 -04:00
Kevin Newton 92af705498 [ruby/prism] Truncate source lines in errors messages when too long
https://github.com/ruby/prism/commit/72518f5716
2024-05-16 19:35:10 +00:00
Kevin Newton 98e1e610f6 [ruby/prism] Update more escape error messages to match CRuby
https://github.com/ruby/prism/commit/ab43b3ab66
2024-05-16 18:40:20 +00:00
Kevin Newton 012a80d768 [PRISM] Enable TestISeq#test_syntax_error_message 2024-05-16 14:21:47 -04:00
Kevin Newton 0b4cf461e0 [PRISM] Enable TestM17N#test_string_mixed_unicode 2024-05-16 14:12:09 -04:00
Kevin Newton 07241dfac8 [PRISM] Enable TestParse#test_question 2024-05-16 12:28:51 -04:00