2 Nov
2025
2 Nov
'25
7:17 a.m.
Issue #21662 has been reported by binh (binh chau). ---------------------------------------- Bug #21662: Variables other than those in the conditional score are replaced. https://bugs.ruby-lang.org/issues/21662 * Author: binh (binh chau) * Status: Open * ruby -v: 3.2.2 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- ``` class Bar attr_accessor :name end class Foo attr_accessor :bar def initialize(bar=nil) @bar = bar || Bar.new end def bug! if !bar.is_a?(Bar) bar = '' elsif bar.name == 'bar' end end end Foo.new.bug! ``` -- https://bugs.ruby-lang.org/