• KOBAYASHI Shuji's avatar
    Add type check (conversion) in `String#[]=` · 4a8b88f7
    KOBAYASHI Shuji authored
    Before this patch:
    
      'a'[0] = 1        #=> 1
      'a'[:a] = '1'     #=> ArgumentError
      'a'[:a, 0] = '1'  #=> ArgumentError
      'a'[0, :a] = '1'  #=> ArgumentError
      'a'[0, 1] = 1     #=> 1
    
    After this patch / Ruby:
    
      'a'[0] = 1        #=> TypeError
      'a'[:a] = '1'     #=> TypeError
      'a'[:a, 0] = '1'  #=> TypeError
      'a'[0, :a] = '1'  #=> TypeError
      'a'[0, 1] = 1     #=> TypeError
    4a8b88f7
string.rb 6.55 KB