summaryrefslogtreecommitdiff
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[ruby/prism] Fix `kDO_LAMBDA` token incompatibility for ↵Koichi ITO
`Prism::Translation::Parser::Lexer` ## Summary This PR fixes `kDO_LAMBDA` token incompatibility between Parser gem and `Prism::Translation::Parser` for lambda `do` block. ### Parser gem (Expected) Returns `kDO_LAMBDA` token: ```console $ bundle exec ruby -Ilib -rparser/ruby33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Parser::Ruby33.new.tokenize(buf)[2]' ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23] [[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 3...5>]], [:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]] ``` ### `Prism::Translation::Parser` (Actual) Previously, the parser returned `kDO` token when parsing the following: ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]' ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23] [[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO, ["do", #<Parser::Source::Range example.rb 3...5>]], [:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]] ``` After the update, the parser now returns `kDO_LAMBDA` token for the same input: ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]' ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23] [[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 3...5>]], [:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]] ``` ## Additional Information Unfortunately, this kind of edge case doesn't work as expected; `kDO` is returned instead of `kDO_LAMBDA`. However, since `kDO` is already being returned in this case, there is no change in behavior. ### Parser gem Returns `tLAMBDA` token: ```console $ bundle exec ruby -Ilib -rparser/ruby33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> (foo = -> (bar) {}) do end"; p Parser::Ruby33.new.tokenize(buf)[2]' ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23] [[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]], [:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 4...7>]], [:tEQL, ["=", #<Parser::Source::Range example.rb 8...9>]], [:tLAMBDA, ["->", #<Parser::Source::Range example.rb 10...12>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 13...14>]], [:tIDENTIFIER, ["bar", #<Parser::Source::Range example.rb 14...17>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 17...18>]], [:tLAMBEG, ["{", #<Parser::Source::Range example.rb 19...20>]], [:tRCURLY, ["}", #<Parser::Source::Range example.rb 20...21>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 21...22>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 23...25>]], [:kEND, ["end", #<Parser::Source::Range example.rb 26...29>]]] ``` ### `Prism::Translation::Parser` Returns `kDO` token: ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> (foo = -> (bar) {}) do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]' ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23] [[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]], [:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 4...7>]], [:tEQL, ["=", #<Parser::Source::Range example.rb 8...9>]], [:tLAMBDA, ["->", #<Parser::Source::Range example.rb 10...12>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 13...14>]], [:tIDENTIFIER, ["bar", #<Parser::Source::Range example.rb 14...17>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 17...18>]], [:tLAMBEG, ["{", #<Parser::Source::Range example.rb 19...20>]], [:tRCURLY, ["}", #<Parser::Source::Range example.rb 20...21>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 21...22>]], [:kDO, ["do", #<Parser::Source::Range example.rb 23...25>]], [:kEND, ["end", #<Parser::Source::Range example.rb 26...29>]]] ``` As the intention is not to address such special cases at this point, a comment has been left indicating that this case still returns `kDO`. In other words, `kDO_LAMBDA` will now be returned except for edge cases after this PR. https://github.com/ruby/prism/commit/2ee480654c
2024-09-20GC guard current_string in the putobject instructionPeter Zhu
This is a band-aid solution for #11655 that only applies the fix for the putobject instruction before the objtostring instruction. This should help fix the use-after-poison in the ASAN CI. http://ci.rvm.jp/logfiles/brlog.trunk_asan.20240920-082802 Notes: Merged: https://github.com/ruby/ruby/pull/11656
2024-09-20[rubygems/rubygems] Disallow RubyGems warnings during Bundler test suiteDavid Rodríguez
https://github.com/rubygems/rubygems/commit/472371ee1e
2024-09-20[rubygems/rubygems] I don't think we need a conditional shebangDavid Rodríguez
https://github.com/rubygems/rubygems/commit/7ba7073a35
2024-09-20[rubygems/rubygems] Fix RubyGems warnings about missing shebangDavid Rodríguez
https://github.com/rubygems/rubygems/commit/362c960497
2024-09-20[rubygems/rubygems] Fix RubyGems warnings about pre-release dependenciesDavid Rodríguez
Nothing here relies on the dependency being on a pre-release, and Bundler does not use prereleases in the realworld. https://github.com/rubygems/rubygems/commit/96f5742ff1
2024-09-20[rubygems/rubygems] Fix RubyGems warnings about incorrect executable permissionsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/92dcf60fc1
2024-09-20[rubygems/rubygems] Fix RubyGems warnings about minimum required RubyDavid Rodríguez
https://github.com/rubygems/rubygems/commit/8f262f3a47
2024-09-20[ruby/prism] Introduce partial_script optionKevin Newton
https://github.com/ruby/prism/commit/b28877fa4f
2024-09-20Remove unneeded function prototype for rb_gc_impl_markPeter Zhu
2024-09-20[rubygems/rubygems] Unconditionally set installed_by_versionSamuel Giddins
It has been supported since RubyGems 2.2.0 via https://github.com/rubygems/rubygems/commit/4525e45a4d45 Signed-off-by: Samuel Giddins <[email protected]> https://github.com/rubygems/rubygems/commit/bf39c583e8
2024-09-20Add c-style for prism [ci skip]Nobuyoshi Nakada
2024-09-20Update parsey.yml as othersNobuyoshi Nakada
2024-09-20[ci-skip] Fix doc for `refinements`OKURA Masafumi
The current doc is partially wrong since `refinements` method returns an array of `Refinement` class, not `Module`. I'm not sure if it's right to link to `Refinement`, but it has some documentation so it should be useful. https://docs.ruby-lang.org/en/3.2/Refinement.html Notes: Merged: https://github.com/ruby/ruby/pull/9248
2024-09-20[ruby/irb] Fix debug command in nomultiline modetomoya ishida
(https://github.com/ruby/irb/pull/1006) * Fix debug command in nomultiline mode * context.colorize_code -> context.colorize_input https://github.com/ruby/irb/commit/71f4d6bfb5
2024-09-20[rubygems/rubygems] Don't try to install locked bundler when `--local` is passedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/907d46964d
2024-09-20Simplify offset calculations of `tbl0208`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5696
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-20Define `tbl0208` as a static arrayNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5696
2024-09-20Extract `iso2022jp_put_state`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5696
2024-09-20Define HAVE_ISINF for Visual Studio >= 2013Silvio Traversaro
isinf is defined in Visual Studio since version 2013. Notes: Merged: https://github.com/ruby/ruby/pull/3758
2024-09-19Fix potentially missing write barrier in iseq_build_kwPeter Zhu
We're writing objects to the iseq but not firing the write barrier. Notes: Merged: https://github.com/ruby/ruby/pull/11647
2024-09-19Replace RB_OBJ_WRITTEN with RB_OBJ_WRITE in iseq_set_arguments_keywordsPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11647
2024-09-19Replace RB_OBJ_WRITTEN with RB_OBJ_WRITE in pm_compile_scope_nodePeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11647
2024-09-19Remove an unused variableTakashi Kokubun
2024-09-19[DOC] Improve docs for GC.latest_gc_infoPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11644
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-19Remove rb_gc_impl_initial_stress_setPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11646
2024-09-19Fix bug at fork on FreeBSDNobuyoshi Nakada
The main thread in a forked process appears not to own the read-write lock. Notes: Merged: https://github.com/ruby/ruby/pull/11648
2024-09-19Don't update lockfile with bundler/inlineHiroshi SHIBATA
2024-09-19Added missing block argHiroshi SHIBATA
2024-09-19[ruby/set] 2024Akinori MUSHA
https://github.com/ruby/set/commit/ea95c5a3d2
2024-09-19[ruby/set] Reword the document for to_a and clarify the implementation notesAkinori MUSHA
ref. https://github.com/ruby/ruby/pull/11453 https://github.com/ruby/set/commit/3cf6d11bd2
2024-09-19Use ppc64le coroutines for powerpc64-freebsd*Piotr Kubaj
There is nothing endianness-related in ppc64le and all the tests pass on both ucontext and ppc64le coroutines on powerpc64-freebsd14.0 Notes: Merged: https://github.com/ruby/ruby/pull/10595
2024-09-19Use ppc64le coroutines on powerpc64le-freebsd*Piotr Kubaj
Only one ractor-related test fails, but it also fails with ucontext. Notes: Merged: https://github.com/ruby/ruby/pull/10595
2024-09-19Adjust indent [ci skip]Nobuyoshi Nakada
2024-09-18Update exception message in string_for_symbolJeremy Evans
This is a static function only called in two places (rb_to_id and rb_to_symbol), and in both places, both symbols and strings are allowed. This makes the error message consistent with rb_check_id and rb_check_symbol. Fixes [Bug #20607] Notes: Merged: https://github.com/ruby/ruby/pull/11097
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-18[DOC] Escape the word GC in GC.configPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11642
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-18[DOC] Fix formatting for ways to create Range objectsPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11641
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-18Move more of GC.latest_gc_info into RubyPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11636
2024-09-18[rubygems/rubygems] Add a note about when hack can be removedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/058b29fe98
2024-09-18[rubygems/rubygems] Fix TODODavid Rodríguez
https://github.com/rubygems/rubygems/commit/2cd13005f6
2024-09-18[rubygems/rubygems] Stop fighting with ourselvesDavid Rodríguez
https://github.com/rubygems/rubygems/commit/7cf2fdcfa1
2024-09-18Fix coding issue in prism_compile.cLuke Gruber
Make sure to set back `ISEQ_COMPILE_DATA(iseq)->current_block` for forwarding super nodes with a block. Fixes [Bug #20740] Notes: Merged: https://github.com/ruby/ruby/pull/11621
2024-09-18[ruby/prism] Allow returns in default parameter valuesKevin Newton
https://github.com/ruby/prism/commit/e98ea15596 Notes: Merged: https://github.com/ruby/ruby/pull/11643