From: nobu@... Date: 2016-06-17T23:15:49+00:00 Subject: [ruby-core:76068] [Ruby trunk Bug#12501][Rejected] Assignment to local variable itself doesn't occur an error Issue #12501 has been updated by Nobuyoshi Nakada. Description updated Status changed from Open to Rejected ---------------------------------------- Bug #12501: Assignment to local variable itself doesn't occur an error https://bugs.ruby-lang.org/issues/12501#change-59264 * Author: Yu Zhang * Status: Rejected * Priority: Normal * Assignee: * ruby -v: 2.3.0 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- For example: ~~~ruby a = b # => undefined local variable or method `b' for main:Object (NameError) ~~~ but ~~~ruby a = a # => nil a = a.merge({}) # => undefined method `merge' for nil:NilClass (NoMethodError) ~~~ The `a` after `=` is an undefined local variable, I think it should raise a `NameError`, but it only returns a nil value. Is this a feature or bug? -- https://bugs.ruby-lang.org/ Unsubscribe: