From: "binh (binh chau) via ruby-core" Date: 2025-11-02T07:17:25+00:00 Subject: [ruby-core:123644] [Ruby Bug#21662] Variables other than those in the conditional score are replaced. 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/ ______________________________________________ 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/lists/ruby-core.ml.ruby-lang.org/