Commit graph

18546 commits

Author SHA1 Message Date
Kevin Newton
d3ba14a31d [PRISM] Do not shell out in prism tests 2024-02-01 14:13:22 -05:00
Stan Lo
ef427123ad [ruby/irb] Add rubocop with a few basic styling rules
(https://github.com/ruby/irb/pull/849)

* Use rubocop to enforce a few styling rules

* Add a CI job for linting

4f60cd88bb
2024-02-01 17:46:02 +00:00
Kevin Newton
494778c663 [ruby/prism] Remove locals_body_index
We're not using this anymore, and it doesn't make a lot of sense
outside the context of a compiler anyway, and in anyway it's wrong
when you have local variables written in default values.

5edbd9c25b
2024-02-01 16:48:55 +00:00
Haldun Bayhantopcu
67c5690a6d [ruby/prism] Check literals for receiver
56441b08e7
2024-02-01 16:48:09 +00:00
Stan Lo
f36c61d27f [ruby/irb] Reset history counter even when @loaded_history_lines is
not defined
(https://github.com/ruby/irb/pull/853)

The issue (https://github.com/ruby/debug/issues/1064) is caused by a
combination of factors:

1. When user starts an IRB session without a history file, the
   `@loaded_history_lines` ivar is not defined.
2. If the user then starts the `irb:rdbg` session, the history counter
   is not set, because the `@loaded_history_lines` is not defined.
3. Because `irb:rdbg` saves the history before passing Ruby expression
   to the debugger, it saves the history with duplicated lines. The number
   grows in exponential order.
4. When the user exits the `irb:rdbg` session, the history file could be
   bloated with duplicated lines.

This commit fixes the issue by resetting the history counter even when
`@loaded_history_lines` is not defined.

4afc98c258
2024-02-01 16:19:07 +00:00
Alan Wu
1f226b41f0 [PRISM] Fix multiple return with splat and splat+kwsplat
Previously, `return *array, 1` didn't behave like `return [*array, 1]`
properly. Also, it crashed when splat and kwsplat is combined like in
`array = [*things, **hash]`.

Fix this by grouping `PM_ARGUMENTS_NODE` with `PM_ARRAY_NODE` handling and
combining splat and kwsplat handling.
2024-02-01 10:33:54 -05:00
Nuno Silva
1236a74023 [ruby/irb] Skip re-setup when creating a child session
(https://github.com/ruby/irb/pull/850)

06b2d00dd3
2024-02-01 12:12:06 +00:00
KJ Tsanaktsidis
da33c5ac9f Revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns"
This reverts commit 673ed41c81.
2024-02-01 11:09:54 +11:00
KJ Tsanaktsidis
67404d657a Revert "always omit test_ai_addrconfig."
This reverts commit abf192eb16.
2024-02-01 11:09:54 +11:00
Stan Lo
6a689e3323 [ruby/irb] Omit 2 encoding error related tests for TruffleRuby
(https://github.com/ruby/irb/pull/854)

They're failing due to an issue in Prism: https://github.com/ruby/prism/issues/2129

So we need to skip them until:
- The issue is fixed in Prism
- TruffleRuby is updated to a version of Prism that includes the fix

bfafaa5fbc
2024-01-31 23:44:15 +00:00
Jeremy Evans
c469799126 Do not modify provided argument splat when using ruby2_keywords with anonymous splat
Previously, this would push the provided keywords onto the argument
splat.  Add ruby2_keywords to the list of other checks for whether
it is safe for treating a given splat as mutable when the called
method accepts an anonymous splat.
2024-01-31 12:44:38 -08:00
Kevin Newton
b4880af0e2 [PRISM] Fix test_bug_reporter with prism 2024-01-31 14:20:51 -05:00
Peter Zhu
cb98b018c0 [PRISM] Fix else with rescue
Fixes ruby/prism#2307.
2024-01-31 14:11:14 -05:00
David Rodriguez
06732d4956 [rubygems/rubygems] Remove truffleruby specific stuff no longer needed
We're already testing with truffleruby 23.

cd0494d628
2024-01-31 16:54:15 +00:00
Hiroshi SHIBATA
c70052e5d9 [rubygems/rubygems] WEBrick:Utils::TimeoutHandler is always provided after webrick gem
b0502a0c50
2024-01-31 13:21:13 +00:00
Hiroshi SHIBATA
3de2ab7fdb [ruby/yaml] Make PStore support as optional
da421ce46f
2024-01-31 05:56:39 +00:00
Hiroshi SHIBATA
7c8f9603b1 [flori/json] Make OpenStruct support as optional
202ffe2335
2024-01-31 14:56:00 +09:00
Matt Valentine-House
8041b7d967 [PRISM] pm_compile_logical: Fix OrNode in IfNode predicate
Fixes: https://github.com/ruby/prism/issues/2294
2024-01-30 22:22:39 +00:00
Aaron Patterson
8e708e4a07 Update forwarding locals for prism 2024-01-30 13:19:06 -05:00
Kevin Newton
ba06a8259a [ruby/prism] Better error messages for unexpected tokens in prefix
a35b8e45ee
2024-01-30 16:10:08 +00:00
tomoya ishida
fd44b42fb3 [ruby/irb] Fix undef and alias indent
(https://github.com/ruby/irb/pull/838)

a641746b18
2024-01-30 12:55:47 +00:00
Nobuyoshi Nakada
86547fd69d
[ruby/io-console] Move the condition to omit to command line option
32583460e1
2024-01-30 19:19:23 +09:00
Nobuyoshi Nakada
c2cb5b4463
[ruby/io-console] Move the condition to omit outside the method
8b9b5b611a
2024-01-30 19:19:23 +09:00
Hiroshi SHIBATA
d187e06dc7 [rubygems/rubygems] Load wrapper file for vendored timeout
deb1b6d293
2024-01-30 13:02:32 +09:00
Peter Zhu
bbb7ab906e [PRISM] Fix crash when multiple underscores
Fixes ruby/prism#2295.
2024-01-29 17:15:33 -05:00
Alan Wu
4cf3c026de Fix RegExp warning causing flaky Ripper failure
Sometimes this file get picked up and break Ripper tests:

    TestRipper::Generic#test_parse_files:test/ruby
    assert_separately failed with error message
    pid 63392 exit 0
    | test_regexp.rb:2025: warning: character class has duplicated range

2098270255 (step):12:103
2024-01-29 17:11:08 -05:00
Kevin Newton
2d6f7d0864 Fix test/ruby/test_rubyoptions.rb + --parser=prism 2024-01-29 17:05:23 -05:00
Peter Zhu
32bbf47500 [PRISM] Use opt_str_freeze instruction
Fixes ruby/prism#2290.
2024-01-29 14:53:34 -05:00
Peter Zhu
3d3d9e8397 [PRISM] Support US-ASCII symbols 2024-01-29 13:56:54 -05:00
Peter Zhu
d980c89273 [PRISM] Support ASCII-8BIT symbols 2024-01-29 13:56:54 -05:00
Peter Zhu
f634c7a268 [PRISM] Support UTF-8 symbols
Fixes ruby/prism#2242.
2024-01-29 13:56:54 -05:00
Kevin Newton
d39d9e066f [ruby/prism] Fix binding power for modifier rescue
f614863d79
2024-01-29 18:42:47 +00:00
Willian Tenfen W
d42330d702 [rubygems/rubygems] Improve gem login scope selection
26c7abe5f6
2024-01-29 17:22:01 +00:00
Alan Wu
b0711b1cf1
YJIT: Fix tailcall and JIT entry eating up FINISH frames (#9729)
Suppose YJIT runs a rb_vm_opt_send_without_block()
fallback and the control frame stack looks like:

```
will_tailcall_bar [FINISH]
caller_that_used_fallback
```

will_tailcall_bar() runs in the interpreter and sets up a tailcall.
Right before JIT_EXEC() in the `send` instruction, the stack will look like:

```
bar [FINISH]
caller_that_used_fallback
```

Previously, JIT_EXEC() ran bar() in JIT code, which caused the `FINISH`
flag to return to the interpreter instead of to the JIT code running
caller_that_used_fallback(), causing code to run twice and probably
crash. Recent flaky failures on CI about "each stub expects a particular
iseq" are probably due to leaving methods twice in
`test_optimizations.rb`.

Only run JIT code from the interpreter if a new frame is pushed.
2024-01-29 12:21:17 -05:00
Peter Zhu
9a5a11f3d0 [PRISM] Use the splatkw instruction
Fixes ruby/prism#2272.
2024-01-29 11:42:40 -05:00
Hiroya Fujinami
3e6e3ca262
Correctly handle consecutive lookarounds (#9738)
Fix [Bug #20207]
Fix [Bug #20212]

Handling consecutive lookarounds in init_cache_opcodes is buggy, so it
causes invalid memory access reported in [Bug #20207] and [Bug #20212].
This fixes it by using recursive functions to detected lookarounds
nesting correctly.
2024-01-29 23:51:26 +09:00
Masato Ohba
933ede5d76 [rubygems/rubygems] Remove travis_removal_info
`travis_removal_info` is added by https://github.com/rubygems/rubygems/pull/6150. According to the comment, it's supposed to be removed at bundler v2.5.0 but it hasn't.

e18797d43f
2024-01-29 05:39:13 +00:00
David Rodríguez
e99951edfa [rubygems/rubygems] Simplify how extensions are built
0b8faf1e39
2024-01-29 12:20:44 +09:00
David Rodríguez
5ea4df6a8f [rubygems/rubygems] Remove annoying debug info
Sometimes you want this, sometimes you don't. And when you don't, this
hides other debugging puts you may have added.

df37582c81
2024-01-29 12:20:44 +09:00
David Rodríguez
d64d0b5423
Vendor uri gem in RubyGems 2024-01-29 12:14:21 +09:00
Nobuyoshi Nakada
bd6f983403 [ruby/win32ole] Use the scoped names in the tests
2b91b6b838
2024-01-28 15:25:35 +00:00
Nobuyoshi Nakada
1e2d088dd3 [ruby/win32ole] Use the scoped names in inspect and error messages
2f51493bd1
2024-01-28 15:25:34 +00:00
Nobuyoshi Nakada
23b8337cd1
[Bug #20219] gettable returns NULL on error 2024-01-28 19:15:31 +09:00
Nobuyoshi Nakada
5f733a1ae7
[Bug #20217] rescue block is void only if all children are void 2024-01-28 18:44:09 +09:00
Nobuyoshi Nakada
fed877c791
[Bug #20217] return with ensure is a void value expression 2024-01-28 18:44:09 +09:00
Kevin Newton
f12ebe1188 [ruby/prism] Add parser translation
8cdec8070c
2024-01-27 19:59:42 +00:00
Kevin Newton
e337c9478a [ruby/prism] Error follow-up
Split up the diagnostic levels so that error and warning levels
aren't mixed. Also fix up deconstruct_keys implementation.

bd3eeb308d

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2024-01-27 18:46:16 +00:00
Benoit Daloze
de135bc247 [ruby/prism] Add level to warnings and errors to categorize them
* Fixes https://github.com/ruby/prism/issues/2082

7a74576357
2024-01-26 21:34:34 +00:00
Kevin Newton
bcafd28a3e [ruby/prism] Symbol encoding follow-up
Ensure we don't accidentally parse the symbol encoding twice, and
ensure we parse it in every circumstance we need to by requiring
it as a parameter.

9cea31c785
2024-01-26 21:14:59 +00:00
Peter Zhu
a120529020 [PRISM] Fix loop in rescue blocks
Fixes ruby/prism#2250.

Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2024-01-26 16:07:24 -05:00