Commit graph

18546 commits

Author SHA1 Message Date
Kevin Menard
2a509787cb [ruby/prism] Track whether a Symbol should have its encoding changed from the source encoding.
Ruby sets a Symbol literal's encoding to US-ASCII if the symbols consists only of US ASCII code points. Character escapes can also lead a Symbol to have a different encoding than its source's encoding.

f315660b31
2024-01-26 20:15:19 +00:00
Peter Zhu
3d996e827f [PRISM] Keyword arguments incorrectly passed as mutable
Fixes ruby/prism#2279.
2024-01-26 14:58:29 -05:00
Haldun Bayhantopcu
7d356b8f0e [ruby/prism] Fix multiple assigns with newlines
b4ba41bdcd
2024-01-26 18:35:54 +00:00
Haldun Bayhantopcu
9a7637da2d [ruby/prism] Add tests
b9ebf987bd
2024-01-26 18:32:31 +00:00
Max Prokopiev
8e5bc8f7c2 [ruby/prism] Change binding power for modifiers in case-in nodes
c31eeba54c
2024-01-26 18:32:02 +00:00
Jeremy Evans
771a2f039b Fix incorrect use of VM_CALL_KW_SPLAT_MUT in zsuper with keyword splat
For zsuper calls with a keyword splat but no actual keywords, the
keyword splat is passed directly, so it cannot be mutable, because
if the callee accepts a keyword splat, changes to the keyword splat
by the callee would be reflected in the caller.

While here, simplify the logic when the method supports
literal keywords.  I don't think it is possible for
a method with has_kw param flags to not have keywords, so add an
assertion for that, and set VM_CALL_KW_SPLAT_MUT in a single place.
2024-01-25 20:43:42 -08:00
Hiroshi SHIBATA
395a240b7c
Try to use irb instead of rubygems for completion test
I'm not sure why OpenBSD suggest `rubygems_plugin` file for this.

20240126T013005Z.fail.html.gz

It seems environmental issue, not irb.
2024-01-26 13:40:05 +09:00
Peter Zhu
5bd6949151 [PRISM] Add raw option to assert_prism_eval 2024-01-25 18:15:45 -05:00
Matt Valentine-House
e452caac10 [PRISM] Fix next inside rescue 2024-01-25 15:10:52 -05:00
Peter Zhu
e7262966c9 [PRISM] Fix indentation of test_ScopeNode 2024-01-25 12:14:22 -05:00
Kevin Newton
1301422dfe [PRISM] Fix VM_CALL_ARGS_SPLAT_MUT failures 2024-01-25 11:11:50 -05:00
Kevin Newton
ebf803aa19 [ruby/prism] Fix Ruby head build
149e2ff7f6
2024-01-25 13:58:07 +00:00
ydah
4bd58e1ade [ruby/irb] diabled ==> disabled
295797ff37
2024-01-25 09:58:17 +00:00
ydah
4d4d418457 [ruby/irb] overrided ==> overridden
b77b23aade
2024-01-25 09:58:14 +00:00
Hiroshi SHIBATA
0f5407b337 Simplified test case for encoding option
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-01-25 16:06:06 +09:00
Hiroshi SHIBATA
d13a57cd65 Use Encoding.local_charmap instead of locale
In my windows environment uses cp932 for terminal encoding.
2024-01-25 16:06:06 +09:00
Hiroshi SHIBATA
1d972498eb Use Encoding::CESU_8 for test case
Encoding::Windows_31J is already loaded in mswin platform
2024-01-25 16:06:06 +09:00
Jeremy Evans
4f77d8d328 Do not use ruby2_keywords for ... argument forwarding
This allows ... argument forwarding to benefit from Allocationless
Anonymous Splat Forwarding, allowing the `f` call below to not
allocate an array or a hash.

```ruby
a = [1]
kw = {b: 2}

def c(a, b:)
end

def f(...)
  c(...)
end

f(*a, **kw)
```

This temporarily skips prism locals tests until prism is changed
to use * and ** for ..., instead of using ruby2_keywords.

Ignore failures in rbs bundled gems tests, since they fail due
to this change.
2024-01-24 18:25:55 -08:00
Hiroshi SHIBATA
2e18228dff Use echo with all platforms 2024-01-25 10:51:18 +09:00
Hiroshi SHIBATA
52085b66d6 Use echo command in mswin platform 2024-01-25 10:51:18 +09:00
Max Prokopiev
a65b52b57f [ruby/prism] Add missing snapshot for the new file
459a9f544e
2024-01-24 20:32:02 +00:00
Max Prokopiev
e9f936df71 [ruby/prism] Extract snippet into its own file and skip in TruffleRuby
12649ee74c
2024-01-24 20:32:02 +00:00
Max Prokopiev
91a5093c15 [ruby/prism] Force encoding during deserialization of constants
otherwise we get failing tests if we have non-ascii
characters in fixtures/**/*.txt

9323243569
2024-01-24 20:32:01 +00:00
Peter Zhu
7d61454f2e [PRISM] Fix method calls in keyword arguments
Fixes ruby/prism#2248.
2024-01-24 15:18:06 -05:00
Aaron Patterson
94f3f9502c Fix repeated block param
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
1817af5074 Fix local table size / index for repeated kwrest
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
13c76e40d3 Fix local table size and variable offset for repeated keywords
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
8b7e78f156 Fix local table size and index for required post underscore
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
bb6af9287b Fix local table space for *_
We need to make sure there is enough room in the local table for
repeated `*_` parameters

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
03f76f098a Fix repeated optional _ parameters
Ensure there is enough space in the local table for repeated optional
parameters.

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Aaron Patterson
29c3ec3d49 Fix required positional repeated _ parameters
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 12:04:44 -08:00
Peter Zhu
020fe6e0ca [PRISM] Fix forwarding from within block
Fixes ruby/prism#2253.
2024-01-24 14:18:25 -05:00
Peter Zhu
dc8fb7d97f [PRISM] Fix crash in anonymous block with forwarding arguments
Fixes ruby/prism#2262.
2024-01-24 13:42:21 -05:00
Kevin Newton
455fb32038 [ruby/prism] Add an implicit node for the target of a hash pattern
This simplifies compiling it, since you can now compile the value
as if it were always there.

bcfc74aacb
2024-01-24 18:37:36 +00:00
Peter Zhu
6b9317c9d5 [PRISM] Don't skip test_ForwardingArgumentsNode
It seems to work with RUBY_ISEQ_DUMP_DEBUG=to_binary so we can try this
test again on CI.
2024-01-24 13:11:41 -05:00
Aaron Patterson
7a33a1aee2 Insert all locals in the locals index table
Prism provides an index (local_body_index) which is supposed to point at
the start of locals declared in the method body. Prism assumed that
method body locals would only occur _after_ parameter names.
Unfortunately this assumption is not correct, which meant that we would
in some cases not insert all locals in the local table.  This commit
iterates over locals a second time, inserting any that didn't get
inserted on the first pass.

Fixes: https://github.com/ruby/prism/issues/2245

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24 09:40:30 -08:00
Peter Zhu
927928badb [PRISM] Fix anonymous keyword arguments
Fixes ruby/prism#2256.
2024-01-24 11:41:08 -05:00
Peter Zhu
529700d314 [PRISM] Nested MultiWriteNode with method calls
Fixes ruby/prism#2247.
2024-01-24 10:08:25 -05:00
Hiroshi SHIBATA
4099b04c09 Pend make option test on mswin platform 2024-01-24 18:12:43 +09:00
Hiroshi SHIBATA
fb39128dce [rubygems/rubygems] Added test for rubygems
64405147c9
2024-01-24 09:11:55 +00:00
Hiroshi SHIBATA
53d0cf442a Use exit 0 instead of true on windows platform 2024-01-24 18:00:12 +09:00
Hiroshi SHIBATA
c8355a8d1f
syslog is already extracted as bundled gems 2024-01-24 15:55:30 +09:00
Hiroshi SHIBATA
270ad76359
Revert "Ensure File.open applies default umask on gem extract"
This reverts commit 01f9766aa0.
2024-01-24 14:10:05 +09:00
Hiroshi SHIBATA
2f06e4f739
Revert "Pend tests on Travis CI"
This reverts commit 772afa00b5.
2024-01-24 14:09:58 +09:00
なつき
1e519abe21 [rubygems/rubygems] Fix rake extension warning
04973e349c
2024-01-24 13:55:42 +09:00
Hiroshi SHIBATA
772afa00b5 Pend tests on Travis CI 2024-01-24 13:50:16 +09:00
Martin Emde
01f9766aa0 Ensure File.open applies default umask on gem extract 2024-01-24 13:50:16 +09:00
Peter Zhu
909a710a69 [PRISM] Fix anonymous splat nodes
Fixes ruby/prism#2257.
2024-01-23 17:45:51 -05:00
Peter Zhu
cecf42601a [PRISM] Fix block fowarding 2024-01-23 15:23:13 -05:00
Peter Zhu
333f4b4930 [PRISM] Support block parameters with no name
Fixes ruby/prism#2249.
2024-01-23 15:23:13 -05:00