summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2024-09-21Make Complex#{inspect,to_s} work correctly if real part #inspect returns ↵Jeremy Evans
frozen string Make static f_format function take a non-frozen string to append to. This does not result in an additional allocation for #inspect, but it does result in an additional allocation for #to_s. Fixes [Bug #20337] Notes: Merged: https://github.com/ruby/ruby/pull/11657
2024-09-20[Bug #18651] Pass undefined region in CP51932 as is to CP50220Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5696
2024-09-19Fix method caching bug when including/prepend module A that prepends module BJeremy Evans
Fix by always adding the generated iclass to the subclasses list, otherwise the method cache for the iclass is not cleared when the method in the module is overwritten. Fixes [Bug #20716] Notes: Merged: https://github.com/ruby/ruby/pull/11582
2024-09-18Raise a compile error for break/next/redo inside eval in cases where it is ↵Jeremy Evans
optimized away In cases where break/next/redo are not valid syntax, they should raise a SyntaxError even if inside a conditional block that is optimized away. Fixes [Bug #20597] Co-authored-by: Kevin Newton <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11099 Merged-By: jeremyevans <[email protected]>
2024-09-18Fix evaluation order issue in f(**h, &h.delete(key))Jeremy Evans
Previously, this would delete the key in `h` before keyword splatting `h`. This goes against how ruby handles `f(*a, &a.pop)` and similar expressions. Fix this by having the compiler check whether the block pass expression is safe. If it is not safe, then dup the keyword splatted hash before evaluating the block pass expression. For expression: `h=nil; f(**h, &h.delete(:key))` VM instructions before: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 getlocal_WC_0 h@0 0006 getlocal_WC_0 h@0 0008 putobject :key 0010 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0012 splatkw 0013 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil 0016 leave ``` VM instructions after: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 putspecialobject 1 0006 newhash 0 0008 getlocal_WC_0 h@0 0010 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0012 getlocal_WC_0 h@0 0014 putobject :key 0016 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0018 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT|KW_SPLAT_MUT>, nil 0021 leave ``` This is the same as 07d3bf4832532ae7446c9a6924d79aed60a7a9a5, except that it removes unnecessary hash allocations when using the prism compiler. Fixes [Bug #20640] Notes: Merged: https://github.com/ruby/ruby/pull/11645 Merged-By: jeremyevans <[email protected]>
2024-09-18Revert "Fix evaluation order issue in f(**h, &h.delete(key))"Jeremy Evans
This reverts commit 07d3bf4832532ae7446c9a6924d79aed60a7a9a5. No failures in the pull request CI, but there are now allocation test failures.
2024-09-18Fix evaluation order issue in f(**h, &h.delete(key))Jeremy Evans
Previously, this would delete the key in h before keyword splatting h. This goes against how ruby handles f(*a, &a.pop) and similar expressions. Fix this by having the compiler check whether the block pass expression is safe. If it is not safe, then dup the keyword splatted hash before evaluating the block pass expression. For expression: `h=nil; f(**h, &h.delete(:key))` VM instructions before: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 getlocal_WC_0 h@0 0006 getlocal_WC_0 h@0 0008 putobject :key 0010 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0012 splatkw 0013 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil 0016 leave ``` VM instructions after: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 putspecialobject 1 0006 newhash 0 0008 getlocal_WC_0 h@0 0010 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0012 getlocal_WC_0 h@0 0014 putobject :key 0016 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0018 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT|KW_SPLAT_MUT>, nil 0021 leave ``` Fixes [Bug #20640] Notes: Merged: https://github.com/ruby/ruby/pull/11206 Merged-By: jeremyevans <[email protected]>
2024-09-18Prevent a warning (retry)Yusuke Endoh
``` test/ruby/test_case.rb:75: warning: 'when' clause on line 75 duplicates 'when' clause on line 75 and is ignored ```
2024-09-17YJIT: Accept key for runtime_stats to return only that stat (#11536)Randy Stauner
Notes: Merged-By: maximecb <[email protected]>
2024-09-17Replace all GC.disable with EnvUtil.without_gcPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11635
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-17TestProcess#test_daemon_noclose is working fine with macOS 15.1 beta3 and ↵Hiroshi SHIBATA
Xcode 16 RC
2024-09-17Prevent a warning due to error recovery of prismYusuke Endoh
2024-09-17Prevent warnings for RubyVM::AbstractSyntaxTree.parse in test_ast.rbYusuke Endoh
2024-09-17Prevent prism warnings in syntax exhaustive testsYusuke Endoh
[Bug #20736] Notes: Merged: https://github.com/ruby/ruby/pull/11626
2024-09-15Prevent warnings: the block passed to ... may be ignoredYusuke Endoh
2024-09-15Prevent warnings: assigned but unused variableYusuke Endoh
2024-09-13[Bug #20725] Should not call compare on `nil`-endpointNobuyoshi Nakada
It means unbounded, always inclusive of other ranges. Notes: Merged: https://github.com/ruby/ruby/pull/11609
2024-09-13Prevent warnings "the block passed to ... may be ignored"Yusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/11611
2024-09-13Prevent a warning: assigned but unused variable - exp_eventsYusuke Endoh
2024-09-13Prevent a warning: assigned but unused variable - t0Yusuke Endoh
2024-09-12[PRISM] Omit some TestAST tests when Prism is enabledKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11497
2024-09-12Switch the default parser from parse.y to PrismKevin Newton
This commit switches the default parser to Prism. There are a couple of additional changes related to this that are a part of this as well to make this happen. * Switch the default parser in parse.h * Remove the Prism-specific workflow and add a parse.y-specific workflow to CI so that it continues to be tested * Update a few test exclusions since Prism has the correct behavior but parse.y doesn't per https://bugs.ruby-lang.org/issues/20504. * Skips a couple of tests on RBS which are failing because they are using RubyVM::AbstractSyntaxTree.of. Fixes [Feature #20564] Notes: Merged: https://github.com/ruby/ruby/pull/11497
2024-09-12Add error checking to readdir, telldir, and closedir calls in dir.cJeremy Evans
Raise SystemCallError exception when these functions return an error. This changes behavior for the following case (found by the tests): ```ruby dir1 = Dir.new('..') dir2 = Dir.for_fd(dir1.fileno) dir1.close dir2.close ``` The above code is basically broken, as `dir1.close` closed the file descriptor. The subsequent `dir2.close` call is undefined behavior. When run in isolation, it raises Errno::EBADF after the change, but if another thread opens a file descriptor between the `dir1.close` and `dir2.close` calls, the `dir2.close` call could close the file descriptor opened by the other thread. Raising an exception is much better in this case as it makes it obvious there is a bug in the code. For the readdir check, since the GVL has already been released, reacquire it rb_thread_call_with_gvl if an exception needs to be raised. Due to the number of closedir calls, this adds static close_dir_data and check_closedir functions. The close_dir_data takes a struct dir_data * and handles setting the dir entry to NULL regardless of failure. Fixes [Bug #20586] Co-authored-by: Nobuyoshi Nakada <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11393 Merged-By: jeremyevans <[email protected]>
2024-09-11Fix issue with super and forwarding arguments in prism_compile.cLuke Gruber
Fixes [Bug #20720] Notes: Merged: https://github.com/ruby/ruby/pull/11565
2024-09-11macOS 10.13(High Sierra) is already EOLHiroshi SHIBATA
2024-09-11Implement BREAK, NEXT and REDO NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11584
2024-09-11Implement WHILE and UNTIL NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11579
2024-09-10Add predicates for platformsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11583
2024-09-09Add keys to GC.stat and fix testsPeter Zhu
This adds keys heap_empty_pages and heap_allocatable_slots to GC.stat.
2024-09-09Switch sorted list of pages in the GC to a darrayPeter Zhu
2024-09-09Implement String#append_as_bytes(String | Integer, ...)Jean Boussier
[Feature #20594] A handy method to construct a string out of multiple chunks. Contrary to `String#concat`, it doesn't do any encoding negociation, and simply append the content as bytes regardless of whether this result in a broken string or not. It's the caller responsibility to check for `String#valid_encoding?` in cases where it's needed. When passed integers, only the lower byte is considered, like in `String#setbyte`. Notes: Merged: https://github.com/ruby/ruby/pull/11552
2024-09-09Return back legacy Range#step behavior for symbol rangeszverok
Notes: Merged: https://github.com/ruby/ruby/pull/11573
2024-09-09Implement WHEN NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11553
2024-09-07Preserve encoding in exception message of `Float`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11564
2024-09-07[Bug #20719] `Float` argument must be ASCII compatibleNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11564
2024-09-06[Feature #20707] Fix negative UTC offset conversionNobuyoshi Nakada
In short, get rid of division and modulo of negative integers. Notes: Merged: https://github.com/ruby/ruby/pull/11561
2024-09-05Move Time#xmlschema in core and optimize itJean Boussier
[Feature #20707] Converting Time into RFC3339 / ISO8601 representation is an significant hotspot for applications that serialize data in JSON, XML or other formats. By moving it into core we can optimize it much further than what `strftime` will allow. ``` compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a62) +YJIT [arm64-darwin23] built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23] warming up...... | |compare-ruby|built-ruby| |:-----------------------|-----------:|---------:| |time.xmlschema | 1.087M| 5.190M| | | -| 4.78x| |utc_time.xmlschema | 1.464M| 6.848M| | | -| 4.68x| |time.xmlschema(6) | 859.960k| 4.646M| | | -| 5.40x| |utc_time.xmlschema(6) | 1.080M| 5.917M| | | -| 5.48x| |time.xmlschema(9) | 893.909k| 4.668M| | | -| 5.22x| |utc_time.xmlschema(9) | 1.056M| 5.707M| | | -| 5.40x| ``` Notes: Merged: https://github.com/ruby/ruby/pull/11510
2024-09-05Optimized instruction for Hash#freezeÉtienne Barrié
If a Hash which is empty or only using literals is frozen, we detect this as a peephole optimization and change the instructions to be `opt_hash_freeze`. [Feature #20684] Co-authored-by: Jean Boussier <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11406
2024-09-05Optimized instruction for Array#freezeÉtienne Barrié
If an Array which is empty or only using literals is frozen, we detect this as a peephole optimization and change the instructions to be `opt_ary_freeze`. [Feature #20684] Co-authored-by: Jean Boussier <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11406
2024-09-05Implement AND/OR NODE operator locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11543
2024-09-04Implement VALIAS NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11531
2024-09-04[Bug #20708] Retry `open` on EINTRNobuyoshi Nakada
Co-Authored-By: Martin Dorey <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11537
2024-09-03Implement ALIAS NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11530
2024-09-03Implement UNDEF NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11523
2024-09-03Range#step: restore legacy behavior for String rangeszverok
Notes: Merged: https://github.com/ruby/ruby/pull/11454
2024-09-02Fix flaky test_latest_gc_info_need_major_byPeter Zhu
It's possible for a GC to run between the calls of GC.latest_gc_info, which would cause the test to fail. We can disable GC so that GC only triggers manually.
2024-08-29Stop using the "undef" keyword to remove a constantAlan Wu
The keyword tries to remove a method of the same name which is unlikely to be the intention of this test: $ ruby -e 'undef Object' -e:1:in '<main>': undefined method 'Object' for class 'Object' (NameError) Found looking at GH-11497. The NameError triggers error_highlight, which loads a bunch of file under GC.stress set by this test when using Prism. That takes a long time, causing a timeout.
2024-08-29[Bug #20704] Win32: Fix chdir to non-ASCII pathNobuyoshi Nakada
On Windows, `chdir` in compilers' runtime libraries uses the active code page, but command line arguments in ruby are always UTF-8, since commit:33ea2646b98adb49ae2e1781753bf22d33729ac0. Notes: Merged: https://github.com/ruby/ruby/pull/11493