1. 08 Feb, 2022 1 commit
    • Koichi ITO's avatar
      Make `Array#*` the CRuby compatible behavior when giving a string argument · 182096d8
      Koichi ITO authored
      ## Summary
      
      This following is a behavior from CRuby 1.8.7 to 3.1.0.
      
      ```console
      % ruby -ve "p ['a', 'b', 'c']*''"
      ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin13.0.2]
      "abc"
      
      % ruby -ve "p ['a', 'b', 'c']*''"
      ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin19]
      "abc"
      ```
      
      ### Before (mruby 3.0.0)
      
      mruby unexpectedly gives the TypeError.
      
      ```ruby
      ['a', 'b', 'c']*'' #=> String cannot be converted to Integer (TypeError)
      ```
      
      ### After
      
      This PR makes mruby behave compatible with CRuby.
      
      ```ruby
      ['a', 'b', 'c']*'' #=> 'abc'
      ```
      
      As far as I checked, the behavior is unspecified when `Array#*`'s argument
      is not an instance of Integer class in X 3017 : 2013 (ISO/IEC 30170 : 2012).
      
      ## Additional Information
      
      I noticed this difference by the following idiom when writing ASCII art code
      using Ruby.
      
      ```ruby
      %w(foo bar baz)*''
      ```
      
      e.g. TRICK (https://github.com/tric)
      182096d8
  2. 07 Feb, 2022 2 commits
  3. 06 Feb, 2022 6 commits
  4. 05 Feb, 2022 4 commits
  5. 03 Feb, 2022 2 commits
  6. 02 Feb, 2022 2 commits
  7. 01 Feb, 2022 2 commits
  8. 31 Jan, 2022 3 commits
  9. 29 Jan, 2022 2 commits
  10. 28 Jan, 2022 2 commits
  11. 27 Jan, 2022 1 commit
  12. 26 Jan, 2022 2 commits
  13. 25 Jan, 2022 9 commits
  14. 24 Jan, 2022 2 commits