
Issue #19739 has been updated by byroot (Jean Boussier). The commit to backport would be: https://github.com/Shopify/ruby/commit/3b351ee62d4206bb72301c2e98dcb173f1e35... ---------------------------------------- Bug #19739: String coderange not cleared by String#slice! https://bugs.ruby-lang.org/issues/19739#change-103621 * Author: ilya.andreyuk (Ilya Andreyuk) * Status: Closed * Priority: Normal * ruby -v: 3.1.4 * Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONTNEED ---------------------------------------- Hello, Key cannot be found in a Hash when slice! method is applied to the key. I cannot reproduce this behaviour with sub! or gsub! methods: ``` ruby hash = {} key = "ABC OÜ" key.slice!(/ oü$/i) # key.sub!(/ oü$/i, '') # key.gsub!(/ oü$/i, '') hash[key] = true "#{key} in #{hash}: value is #{hash[key]}" => "ABC in {\"ABC\"=>true}: value is " ``` Also it seems that ruby 2.7.6 and 3.2.2 don't have this issue. -- https://bugs.ruby-lang.org/