
Issue #20468 has been updated by Eregon (Benoit Daloze). Given `for foo.bar in []; end` is valid and does `for.bar = element`, I think `for foo&.bar in []; end` could simply do `for&.bar = element` which is the same as `for.bar = element unless foo.nil?` (`NIL_P(foo)` to be precise). Changing the syntax for `for` variables sounds more risky and likely to unexpectedly disallow some new `lhs` forms when the `lhs` rule is updated, and the `for_var` rule is forgotten to be updated too. ---------------------------------------- Bug #20468: Segfault on safe navigation in for target https://bugs.ruby-lang.org/issues/20468#change-108179 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- ```ruby for foo&.bar in []; end ``` -- https://bugs.ruby-lang.org/