[ruby-core:112550] [Ruby master Bug#18629] block args array splatting assigns to higher scope _ var

Issue #18629 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE ruby_3_1 536f5ba0d48c033e63398d1751aebd0a11bcc6ff merged revision(s) 3ddf6ad4d2f6dae4caa00b8c407768c7062099a0. ---------------------------------------- Bug #18629: block args array splatting assigns to higher scope _ var https://bugs.ruby-lang.org/issues/18629#change-101997 * Author: Nakilon (Victor Maslov) * Status: Closed * Priority: Normal * ruby -v: 3.0.2 * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE ---------------------------------------- ``` ruby v = 1; [[2]].each{ |(v)| }; p v _ = 1; [[2]].each{ |(_)| }; p _ ``` prints ``` 1 2 ``` You can see here that `v` is still `1` but `_` isn't shadowed properly and is being assigned `2`. Reproducible from 2.3.8 to 3.0.2 (macOS rbenv) -- https://bugs.ruby-lang.org/
participants (1)
-
nagachika (Tomoyuki Chikanaga)