From: ibylich@... Date: 2020-12-23T15:44:32+00:00 Subject: [ruby-core:101655] [Ruby master Bug#17431] paren_nest is not reset in parse.y after "foo.[]= value" Issue #17431 has been updated by ibylich (Ilya Bylich). Ok, got an example with lambdas: ``` $ ./miniruby -ce '->(opt = (foo.[]= bar)) do end' -e:1: syntax error, unexpected `do', expecting `do' for lambda or tLAMBEG ->(opt = (foo.[]= bar)) do end -e:1: warning: paren_nest = 1 $ ./miniruby -ce '->(opt = (foo.x= bar)) do end' -e:1: warning: paren_nest = 0 Syntax OK ``` ---------------------------------------- Bug #17431: paren_nest is not reset in parse.y after "foo.[]= value" https://bugs.ruby-lang.org/issues/17431#change-89444 * Author: ibylich (Ilya Bylich) * Status: Assigned * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * ruby -v: ruby 3.0.0dev (2020-12-23T14:40:04Z master 94015200b6) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- `p->lex.paren_nest` is equal to 1 after the following code: ```ruby self.[]= foo ``` `paren_nest` is used to differentiate `...` for ranges/forwarded arguments, and so `./miniruby -we 'foo.[]= bar, ...'` gives no `... at EOL, should be parenthesized?` warning (`./miniruby -we 'foo.x= bar, ...'` does). Also it's used to differentiate `kDO` vs `kDO_LAMBDA`, so I believe there are code samples with lambdas and `.[]=` calls that can't be handled by Ruby but are technically valid. -- https://bugs.ruby-lang.org/ Unsubscribe: