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

19306 Коммитов

Автор SHA1 Сообщение Дата
Hiroaki Osawa 5d33ff36dc [ruby/reline] In ed_search_[prev|next]_history, make the cursor come
to the end of the line when there is no search substr
(https://github.com/ruby/reline/pull/714)

* In ed_search_prev_history, make the cursor come to the end of the line when there is no search substr

* In ed_search_next_history, make the cursor come to the end of the line when there is no search substr

* Implemented ActionState to search with empty substr if the previous operation was search with empty string.

* Use a simple 2-element array to represent action_state

https://github.com/ruby/reline/commit/95ee80bd70
2024-06-03 14:05:51 +00:00
tomoya ishida 91d4a7ae0c [ruby/reline] Improve key binding match/matching check
(https://github.com/ruby/reline/pull/709)

* Improve key binding match/matching check

* Rename key_actors to default_key_bindings

* Make key_stroke.expand always return a value

* Update add_default_key_binding to use a add_default_key_binding_by_keymap internally

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/reline/commit/353ec236e2

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-06-03 13:15:05 +00:00
Jean Boussier 730e3b2ce0 Stop exposing `rb_str_chilled_p`
[Feature #20205]

Now that chilled strings no longer appear as frozen, there is no
need to offer an API to check for chilled strings.

We however need to change `rb_check_frozen_internal` to no
longer be a macro, as it needs to check for chilled strings.
2024-06-02 13:53:35 +02:00
Nobuyoshi Nakada 05553cf22d
[Bug #20517] Make a multibyte character one token at meta escape 2024-06-01 19:33:12 +09:00
Stan Lo cda69b5910 [ruby/reline] Overhaul io gate structure
(https://github.com/ruby/reline/pull/666)

* Overhaul IO gate structure

1. Move IO related classes to `lib/reline/io/` directory.
2. Rename `GeneralIO` to `Dumb`.
3. Use IO classes as instances instead of classes.

* Update lib/reline/io/ansi.rb

Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>

---------

https://github.com/ruby/reline/commit/dc1518e1ac

Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
2024-06-01 10:28:08 +00:00
akr 3ee83c73c3
Tempfile.create(anonymous: true) implemented. (#10803)
The keyword argument `anonymous` is implemented for `Tempfile.create`

The default is `anonymous: false`.
The behavior is not changed as before.

The created temporary file is immediately removed if `anonymous: true` is specified.
So applications don't need to remove the file.
The actual storage of the file is reclaimed by the OS when the file is closed.

It uses `O_TMPFILE` for Linux 3.11 or later.
It creates an anonymous file from the beginning.

It uses FILE_SHARE_DELETE for Windows.
It makes it possible to remove the opened file.

[Feature #20497]
2024-06-01 15:11:19 +09:00
Kevin Newton b5c8fb9a3f [ruby/prism] Fix up heredoc location translation for parser
https://github.com/ruby/prism/commit/a4e164e22b
2024-05-31 19:31:53 +00:00
Kevin Newton 63ea77916a [ruby/prism] Match % strings in parser
https://github.com/ruby/prism/commit/840185110f
2024-05-31 19:31:53 +00:00
Kevin Newton 1b392ba7c6 [ruby/prism] Use correct opening and closing parenthesis for array pattern in parser
https://github.com/ruby/prism/commit/beed43922c
2024-05-31 19:31:53 +00:00
Kevin Newton 47f05dffa1 [ruby/prism] Match match_hash_var when quotes are used
https://github.com/ruby/prism/commit/f2a327449a
2024-05-31 19:31:52 +00:00
Kevin Newton 02b27aca50 [ruby/prism] Match parser for match_rest in pattern
https://github.com/ruby/prism/commit/785de2c39d
2024-05-31 19:31:52 +00:00
David Rodríguez 10c256f98f Sychronize with rubygems/rubygems repo 2024-06-01 01:13:55 +09:00
Jeremy Evans 89486c79bb
Make error messages clear blocks/keywords are disallowed in index assignment
Blocks and keywords are allowed in regular index.

Also update NEWS to make this more clear.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-05-31 08:22:40 -07:00
David Rodriguez 8e2a6435e4 [rubygems/rubygems] Fix `gem uninstall` warning when two versions of psych installed
https://github.com/rubygems/rubygems/commit/1b5644b666
2024-05-31 15:09:37 +00:00
David Rodríguez 5668933296 [rubygems/rubygems] Extract a `spec` variable
It's consistent with the previous test and makes print debugging easier.

https://github.com/rubygems/rubygems/commit/d7f424df16
2024-05-31 11:58:00 +00:00
David Rodríguez 21f10cabb9 [rubygems/rubygems] Improve spec about `rubygems-update` in non default path
Make it not also install the gem in the default GEM_HOME.

https://github.com/rubygems/rubygems/commit/22de9a810a
2024-05-31 11:58:00 +00:00
David Rodríguez 530c85be49 [rubygems/rubygems] Remove unnecessary reset
https://github.com/rubygems/rubygems/commit/33328e54fd
2024-05-31 11:58:00 +00:00
Sorah Fukumori fd549b229b
test_bignum: defined? returns String (#10880)
didn't verify the test is working properly due to mistaken auto-merge… [Bug #20515] 

bug: https://bugs.ruby-lang.org/issues/20515
follow-up: 22e4eeda65
follow-up: https://github.com/ruby/ruby/pull/10875
2024-05-30 19:59:30 +00:00
Kevin Newton 4558abec02 [ruby/prism] Disallow unescape test on FFI backend
https://github.com/ruby/prism/commit/32277722d4
2024-05-30 19:36:40 +00:00
Kevin Newton 72452f4387 [ruby/prism] Tests overhaul
https://github.com/ruby/prism/commit/6f886be0a4
2024-05-30 15:18:20 -04:00
Sorah Fukumori 22e4eeda65
ci: Test whether GMP is working in compilers.yml (#10875)
Avoid reoccurence of [Bug #20515]

Requires https://github.com/ruby/ruby/pull/10876 since 18eaf0be90

bug: https://bugs.ruby-lang.org/issues/20515
2024-05-30 18:44:31 +00:00
Jean Boussier 15501e13d7 [ruby/stringio] Remove special handling of chilled strings
[Feature #20205]

Followup: https://github.com/ruby/stringio/pull/94

They no longer need to be special cases. If StringIO end up
mutating a chilled string, a warning will be emitted.

https://github.com/ruby/stringio/commit/dc62d65449
2024-05-30 15:11:48 +00:00
Hiroshi SHIBATA ba8e6e77fd
Revert "[rubygems/rubygems] Fix `gem pristine` sometimes failing to pristine user installed gems"
This reverts commit a3edc4abc5.

That commit caused test failure with Windows platform.

* https://github.com/ruby/ruby/actions/runs/9289018414/job/25561871390
* https://github.com/ruby/ruby/actions/runs/9289018425/job/25561873060
2024-05-30 12:46:19 +09:00
David Rodriguez a3edc4abc5 [rubygems/rubygems] Fix `gem pristine` sometimes failing to pristine user installed gems
https://github.com/rubygems/rubygems/commit/0eb6ed8f86
2024-05-29 15:35:04 +00:00
Kevin Newton bc3199bb29 [PRISM] Enable TestAssignmentGen#test_assignment 2024-05-28 15:30:32 -04:00
Kevin Newton a7eb3d077b [PRISM] Enable TestISeq#test_trace_points 2024-05-28 14:24:18 -04:00
Kevin Newton 07f494ccad [PRISM] Enable TestISeq#test_each_child 2024-05-28 14:24:18 -04:00
Kevin Newton fd95ba255a Make ensure first lineno the first line of the ensure
Previously, ensure ISEQs took their first line number from the
line number coming from the AST. However, if this is coming from
an empty `begin`..`end` inside of a method, this can be all of the
way back to the method declaration. Instead, this commit changes
it to be the first line number of the ensure block itself.

The first_lineno field is only accessible through manual ISEQ
compilation or through tracepoint. Either way, this will be more
accurate for targeting going forward.
2024-05-28 13:12:21 -04:00
Kevin Newton 8f84fbbf96 [PRISM] Enable TestSyntax#test_dedented_heredoc_continued_line 2024-05-28 13:11:52 -04:00
Nobuyoshi Nakada 31c9a3a1d3 [Bug #20438] Disallow "%\n" and "%\0" 2024-05-29 01:02:32 +09:00
É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