summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2024-02-05[PRISM] Fix encoding of interpolated stringsPeter Zhu
Fixes ruby/prism#2313.
2024-02-05[PRISM] Implement opt_aset_withJenny Shen
Part of ruby/prism#2231 Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2024-02-02[PRISM] Fix numbered parameters stealing local namesAlan Wu
Previously, the local index of numbered parameters were assigned to names of regular locals, making it hard to read both of them. Use proper `_[1-9]` numbered parameters. This fixes `test_shapes.rb`. Also, properly mark the iseq as having lead parameters.
2024-02-02Add memory leak test for Regexp timeoutPeter Zhu
[Bug #20228]
2024-02-02Add an assertion that `%x` literals call `` ` `` methodNobuyoshi Nakada
2024-02-01[PRISM] Respect string encoding override in array literalsAlan Wu
Fixes `TestZlibGzipReader#test_gets2`, `Psych_Unit_Tests#test_spec_explicit_families`, and many failures in `test_unicode_normalize.rb`.
2024-02-01[PRISM] dedup hash string keysJenny Shen
Fixes ruby/prism#2321 Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2024-02-01[PRISM] Do not shell out in prism testsKevin Newton
2024-02-01[PRISM] Fix multiple return with splat and splat+kwsplatAlan Wu
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-01-31Do not modify provided argument splat when using ruby2_keywords with ↵Jeremy Evans
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[PRISM] Fix else with rescuePeter Zhu
Fixes ruby/prism#2307.
2024-01-30[PRISM] pm_compile_logical: Fix OrNode in IfNode predicateMatt Valentine-House
Fixes: https://github.com/ruby/prism/issues/2294
2024-01-30Update forwarding locals for prismAaron Patterson
2024-01-29[PRISM] Fix crash when multiple underscoresPeter Zhu
Fixes ruby/prism#2295.
2024-01-29Fix RegExp warning causing flaky Ripper failureAlan Wu
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 https://github.com/ruby/ruby/actions/runs/7699956651/job/20982702553#step:12:103
2024-01-29Fix test/ruby/test_rubyoptions.rb + --parser=prismKevin Newton
2024-01-29[PRISM] Use opt_str_freeze instructionPeter Zhu
Fixes ruby/prism#2290.
2024-01-29[PRISM] Support US-ASCII symbolsPeter Zhu
2024-01-29[PRISM] Support ASCII-8BIT symbolsPeter Zhu
2024-01-29[PRISM] Support UTF-8 symbolsPeter Zhu
Fixes ruby/prism#2242.
2024-01-29YJIT: Fix tailcall and JIT entry eating up FINISH frames (#9729)Alan Wu
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[PRISM] Use the splatkw instructionPeter Zhu
Fixes ruby/prism#2272.
2024-01-29Correctly handle consecutive lookarounds (#9738)Hiroya Fujinami
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-28[Bug #20219] `gettable` returns NULL on errorNobuyoshi Nakada
2024-01-28[Bug #20217] `rescue` block is void only if all children are voidNobuyoshi Nakada
2024-01-28[Bug #20217] `return` with `ensure` is a void value expressionNobuyoshi Nakada
2024-01-26[PRISM] Fix loop in rescue blocksPeter Zhu
Fixes ruby/prism#2250. Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2024-01-26[PRISM] Keyword arguments incorrectly passed as mutablePeter Zhu
Fixes ruby/prism#2279.
2024-01-25Fix incorrect use of VM_CALL_KW_SPLAT_MUT in zsuper with keyword splatJeremy Evans
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[PRISM] Add raw option to assert_prism_evalPeter Zhu
2024-01-25[PRISM] Fix next inside rescueMatt Valentine-House
2024-01-25[PRISM] Fix indentation of test_ScopeNodePeter Zhu
2024-01-25Simplified test case for encoding optionHiroshi SHIBATA
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-01-25Use Encoding.local_charmap instead of localeHiroshi SHIBATA
In my windows environment uses cp932 for terminal encoding.
2024-01-24Do not use ruby2_keywords for ... argument forwardingJeremy Evans
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-25Use echo with all platformsHiroshi SHIBATA
2024-01-25Use echo command in mswin platformHiroshi SHIBATA
2024-01-24[PRISM] Fix method calls in keyword argumentsPeter Zhu
Fixes ruby/prism#2248.
2024-01-24Fix repeated block paramAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size / index for repeated kwrestAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size and variable offset for repeated keywordsAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size and index for required post underscoreAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table space for `*_`Aaron Patterson
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-24Fix repeated optional _ parametersAaron Patterson
Ensure there is enough space in the local table for repeated optional parameters. Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix required positional repeated _ parametersAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24[PRISM] Fix forwarding from within blockPeter Zhu
Fixes ruby/prism#2253.
2024-01-24[PRISM] Fix crash in anonymous block with forwarding argumentsPeter Zhu
Fixes ruby/prism#2262.
2024-01-24[PRISM] Don't skip test_ForwardingArgumentsNodePeter Zhu
It seems to work with RUBY_ISEQ_DUMP_DEBUG=to_binary so we can try this test again on CI.
2024-01-24Insert all locals in the locals index tableAaron Patterson
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[PRISM] Fix anonymous keyword argumentsPeter Zhu
Fixes ruby/prism#2256.