summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
AgeCommit message (Collapse)Author
2024-09-17Fix a typo, sorry!Yusuke Endoh
2024-09-17Prevent two warningsYusuke Endoh
``` /home/chkbuild/chkbuild/tmp/build/20240917T123003Z/ruby/test/ruby/test_case.rb:73: warning: 'when' clause on line 73 duplicates 'when' clause on line 73 and is ignored /home/chkbuild/chkbuild/tmp/build/20240917T123003Z/ruby/test/ruby/test_syntax.rb:333: warning: key :k1 is duplicated and overwritten on line 333 ```
2024-09-13Prevent warnings "the block passed to ... may be ignored"Yusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/11611
2024-08-15[PRISM] test_invalid_jump assertion updates for prismKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11386
2024-07-21Fix a typo in setup of block-after-blockcall testsNobuyoshi Nakada
Unparenthesize the argument and make `command_call` when calling with `do`-block. Notes: Merged: https://github.com/ruby/ruby/pull/11216
2024-07-21Fix SEGV on method call with empty args and brace block for do block command ↵yui-knk
call Notes: Merged: https://github.com/ruby/ruby/pull/11215
2024-06-06Remove circular parameter syntax errorKevin Newton
https://bugs.ruby-lang.org/issues/20478
2024-05-24Update duplicated when clause warning messageKevin Newton
2024-05-22[PRISM] Properly support 'it'Kevin Newton
2024-05-20[PRISM] Enable TestSyntax#test_warn_balancedKevin Newton
2024-05-16[PRISM] Enable TestSyntax#test_syntax_error_at_newlineKevin Newton
2024-05-16[Bug #20468] Fix safe navigation in `for` variableNobuyoshi Nakada
2024-05-08[Bug #20474] Keep spaces in leading blank lineNobuyoshi Nakada
2024-05-07[PRISM] Enable test_methoddef_endless_commandKevin Newton
2024-04-12[Bug #20423] Disallow anonymous block within argument forwardingNobuyoshi Nakada
2024-04-02[Feature #20331] Simplify parser warnings for hash keys duplication and when ↵yui-knk
clause duplication This commit simplifies warnings for hash keys duplication and when clause duplication, based on the discussion of https://bugs.ruby-lang.org/issues/20331. Warnings are reported only when strings are same to ohters.
2024-03-26[Bug #20392] Block arguments duplication check at `super`Nobuyoshi Nakada
2024-02-23[Bug #20295] Fix SEGV when parsing invalid regexpyui-knk
2024-02-20Add pushtoarraykwsplat instruction to avoid unnecessary array allocationJeremy Evans
This is designed to replace the newarraykwsplat instruction, which is no longer used in the parse.y compiler after this commit. This avoids an unnecessary array allocation in the case where ARGSCAT is followed by LIST with keyword: ```ruby a = [] kw = {} [*a, 1, **kw] ``` Previous Instructions: ``` 0000 newarray 0 ( 1)[Li] 0002 setlocal_WC_0 a@0 0004 newhash 0 ( 2)[Li] 0006 setlocal_WC_0 kw@1 0008 getlocal_WC_0 a@0 ( 3)[Li] 0010 splatarray true 0012 putobject_INT2FIX_1_ 0013 putspecialobject 1 0015 newhash 0 0017 getlocal_WC_0 kw@1 0019 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0021 newarraykwsplat 2 0023 concattoarray 0024 leave ``` New Instructions: ``` 0000 newarray 0 ( 1)[Li] 0002 setlocal_WC_0 a@0 0004 newhash 0 ( 2)[Li] 0006 setlocal_WC_0 kw@1 0008 getlocal_WC_0 a@0 ( 3)[Li] 0010 splatarray true 0012 putobject_INT2FIX_1_ 0013 pushtoarray 1 0015 putspecialobject 1 0017 newhash 0 0019 getlocal_WC_0 kw@1 0021 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0023 pushtoarraykwsplat 0024 leave ``` pushtoarraykwsplat is designed to be simpler than newarraykwsplat. It does not take a variable number of arguments from the stack, it pops the top of the stack, and appends it to the second from the top, unless the top of the stack is an empty hash. During this work, I found the ARGSPUSH followed by HASH with keyword did not compile correctly, as it pushed the generated hash to the array even if the hash was empty. This fixes the behavior, to use pushtoarraykwsplat instead of pushtoarray in that case: ```ruby a = [] kw = {} [*a, **kw] [{}] # Before [] # After ``` This does not remove the newarraykwsplat instruction, as it is still referenced in the prism compiler (which should be updated similar to this), YJIT (only in the bindings, it does not appear to be implemented), and RJIT (in a couple comments). After those are updated, the newarraykwsplat instruction should be removed.
2024-02-19[Bug #20280] Raise SyntaxError on invalid encoding symbolNobuyoshi Nakada
2024-02-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2024-02-13Fix memory leak when parsing invalid hash symbolPeter Zhu
For example: 10.times do 100_000.times do eval('{"\xC3": 1}') rescue EncodingError end puts `ps -o rss= -p #{$$}` end Before: 32032 48464 66112 84192 100592 117520 134096 150656 167168 183760 After: 17120 17120 17120 17120 18560 18560 18560 18560 18560 18560
2024-01-28[Bug #20219] `gettable` returns NULL on errorNobuyoshi Nakada
2024-01-28[Bug #20217] `return` with `ensure` is a void value expressionNobuyoshi Nakada
2024-01-05Add test cases for duplicated `when\' clause warningsyui-knk
Add test cases for `__LINE__` and `__FILE__` because they were managed by NODE_LIT and NODE_STR but changed to be managed by dedicated NODE now.
2024-01-02Introduce NODE_FILEyui-knk
`__FILE__` was managed by `NODE_STR` with `String` object. This commit introduces `NODE_FILE` and `struct rb_parser_string` so that 1. `__FILE__` is detectable from AST Node 2. Reduce dependency ruby object
2024-01-02Warn "literal in condition" for `__LINE__`yui-knk
Print warning for a code like ```ruby if __LINE__ end # => warning: literal in condition ```
2023-12-25suppress a warningNARUSE, Yui
2023-12-25[Feature #19370] Blocks without anonymous parameters should not affectNobuyoshi Nakada
2023-12-25Implement `it` (#9199)Takashi Kokubun
[[Feature #18980]](https://bugs.ruby-lang.org/issues/18980) Co-authored-by: Yusuke Endoh <[email protected]>
2023-12-25[Feature #19370] Prohibit nesting anonymous parameter forwardingNobuyoshi Nakada
2023-12-23Adjust indent [ci skip]Nobuyoshi Nakada
2023-12-16[Bug #20062] Fixed numbered parameter syntax errorNobuyoshi Nakada
At the method definition, the local scope that saves the context of the numbered parameters needs to be pushed before saving.
2023-12-12Prevent a warning: method redefinedYusuke Endoh
2023-12-07Support eval "return" at toplevelJeremy Evans
Since Ruby 2.4, `return` is supported at toplevel. This makes `eval "return"` also supported at toplevel. This mostly uses the same tests as direct `return` at toplevel, with a couple differences: `END {return if false}` is a SyntaxError, but `END {eval "return" if false}` is not an error since the eval is never executed. `END {return}` is a SyntaxError, but `END {eval "return"}` is a LocalJumpError. The following is a SyntaxError: ```ruby class X nil&defined?0--begin e=no_method_error(); return; 0;end end ``` However, the following is not, because the eval is never executed: ```ruby class X nil&defined?0--begin e=no_method_error(); eval "return"; 0;end end ``` Fixes [Bug #19779]
2023-12-07Warn `it` (#9152)Takashi Kokubun
https://bugs.ruby-lang.org/issues/18980
2023-11-21Add a testTSUYUSATO Kitsune
2023-10-26Prevent a warning: assigned but unused variable - zYusuke Endoh
2023-10-26[Bug #19973] Warn duplicated keyword arguments after keyword splatNobuyoshi Nakada
2023-09-01[Bug #19281] Allow semicolon in parenthesis at the first argument of command ↵yui-knk
call Allow compstmt in the first argument of command call wrapped with parenthesis like following arguments with parenthesis. Notes: Merged: https://github.com/ruby/ruby/pull/8347
2023-09-01[Bug-18878] Parse qualified const with brace block as method callNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8343
2023-08-03Remove --disable-gems for assert_separatelyPeter Zhu
assert_separately adds --disable=gems so we don't need to add --disable-gems when calling assert_separately. Notes: Merged: https://github.com/ruby/ruby/pull/8162
2023-07-19Add a corner case for `return`Nobuyoshi Nakada
2023-07-19[Bug #19774] Fix segfault at `return` in `END`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8093
2023-07-19Add tests for `return` in `BEGIN` and `END` blocksNobuyoshi Nakada
2023-05-14[Bug #19025] Numbered parameter names are always local variablesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7810
2023-05-02[Bug #19619] Preserve numbered parameters contextNobuyoshi Nakada
Preserve numbered parameters context across method definitions
2023-03-21Use indented heredocNobuyoshi Nakada
2022-12-15Disallow mixed usage of ... and */**Shugo Maeda
[Feature #19134] Notes: Merged: https://github.com/ruby/ruby/pull/6934
2022-11-29Add tests for [Feature #19134]Shugo Maeda
https://bugs.ruby-lang.org/issues/19134?next_issue_id=19133&prev_issue_id=19135#note-4