Issue #15952 has been reported by luke-gru (Luke Gruber).

----------------------------------------
Bug #15952: Issue with Array#unshift, sometimes doesn't respect frozenness of array
https://bugs.ruby-lang.org/issues/15952

* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
This should raise a `FrozenError`, but doesn't:

```ruby
a = [1] * 100
b = a[4..-1]
a.replace([1])
b.freeze
b.unshift("a") # no error
```

There is a code path in `ary_ensure_room_for_unshift` where the frozen check is skipped. I'll hoist this check to the top of the function in a PR.

Thanks,



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>