From: "nagachika (Tomoyuki Chikanaga) via ruby-core" Date: 2023-02-23T06:11:45+00:00 Subject: [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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/