summaryrefslogtreecommitdiff
path: root/test/ruby/test_compile_prism.rb
AgeCommit message (Collapse)Author
2025-12-08merge revision(s) 0b0da6c4b26f80ad6985722d3fc0f5cdee09125d: [Backport #21648]Takashi Kokubun
[PATCH] Correctly compile splats in for-loop index in prism Fixes [Bug #21648] This is a followup to https://github.com/ruby/ruby/pull/13597. The added test passed but didn't emit the same instructions. This also handles bare splats and aligns instructions for all cases
2025-07-14merge revision(s) 5ec9a392cdf7f971221dc073dd466bce877d8acb: [Backport #21439]Takashi Kokubun
[Bug #21439] Fix `PM_SPLAT_NODE` compilation error in for loops (#13597) [Bug #21439] Fix PM_SPLAT_NODE compilation error in for loops This commit fixes a crash that occurred when using splat nodes (*) as the index variable in for loops. The error "Unexpected node type for index in for node: PM_SPLAT_NODE" was thrown because the compiler didn't know how to handle splat nodes in this context. The fix allows code like `for *x in [[1,2], [3,4]]` to compile and execute correctly, where the splat collects each sub-array.
2025-02-13merge revision(s) 63723c8d5908569918fb27e070ae5bc9de33c8bd: [Backport #21014]Takashi Kokubun
Correctly set node_id on iseq location The iseq location object has a slot for node ids. parse.y was correctly populating that field but Prism was not. This commit populates the field with the ast node id for that iseq [Bug #21014]
2025-02-13merge revision(s) 31905d9e23ec6d1fa2a52f1ef2533f2056e7c9fb: [Backport #21001]Takashi Kokubun
Allow escaping from ensures through next Fixes [Bug #21001]
2024-12-20[PRISM] Treat it as a local when compiling patternsMatt Valentine-House
Fixes [Bug #20973] Notes: Merged: https://github.com/ruby/ruby/pull/12408
2024-12-20[PRISM] Fix compiling popped opt_str_uminus and opt_str_freezeKazuki Yamaguchi
Put a pop as needed. This example currently causes [BUG]: $ ruby --parser=prism -e'1.times{"".freeze;nil}' -e:1: [BUG] Stack consistency error (sp: 15, bp: 14) ruby 3.4.0dev (2024-12-20T00:48:01Z master 978df259ca) +PRISM [x86_64-linux] Notes: Merged: https://github.com/ruby/ruby/pull/12410
2024-12-17[PRISM] Recurse use_deconstructed_cache in Alternation NodesMatt Valentine-House
This fixes the behavioural difference between Prism and parse.y when evaluating the following code ```ruby 1 in [1 | [1]] ``` Fixes [Bug #20956] Notes: Merged: https://github.com/ruby/ruby/pull/12370
2024-10-04Fix intermediate array off-by-one errorKevin Newton
Co-authored-by: Adam Hess <HParker@github.com> Notes: Merged: https://github.com/ruby/ruby/pull/11800
2024-09-28[Bug #20763] Add testsNobuyoshi Nakada
2024-06-20[PRISM] Remove duplicated testsKevin Newton
These tests are flaky and are duplicative of other tests that are run in CI when parser=prism.
2024-04-12[Bug #20423] Disallow anonymous block within argument forwardingNobuyoshi Nakada
2024-03-19Implement chilled stringsÉtienne Barrié
[Feature #20205] As a path toward enabling frozen string literals by default in the future, this commit introduce "chilled strings". From a user perspective chilled strings pretend to be frozen, but on the first attempt to mutate them, they lose their frozen status and emit a warning rather than to raise a `FrozenError`. Implementation wise, `rb_compile_option_struct.frozen_string_literal` is no longer a boolean but a tri-state of `enabled/disabled/unset`. When code is compiled with frozen string literals neither explictly enabled or disabled, string literals are compiled with a new `putchilledstring` instruction. This instruction is identical to `putstring` except it marks the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags. Chilled strings have the `FL_FREEZE` flag as to minimize the need to check for chilled strings across the codebase, and to improve compatibility with C extensions. Notes: - `String#freeze`: clears the chilled flag. - `String#-@`: acts as if the string was mutable. - `String#+@`: acts as if the string was mutable. - `String#clone`: copies the chilled flag. Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-03-17[Bug #20218] Reject keyword arguments in indexNobuyoshi Nakada
2024-03-17[Bug #19918] Reject block passing in indexNobuyoshi Nakada
2024-02-13[PRISM] Add eval testsMatt Valentine-House
2024-02-13[PRISM] Fix lambda start column numberNikita Vasilevsky
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2024-02-11[PRISM] Fix error handling in `pm_parse_prism`eileencodes
Following changes made in ruby/prism#2365 this implements error handling for when `pm_string_mapped_init` returns `false`. Related: ruby/prism#2207
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-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-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-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-29[PRISM] Use the splatkw instructionPeter Zhu
Fixes ruby/prism#2272.
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-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-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.