From: "jfi (James Inman) via ruby-core" Date: 2025-11-23T22:10:08+00:00 Subject: [ruby-core:123890] [Ruby Bug#21708] Ruby 3.4 Forwardable: setter delegations trigger SyntaxError from forwardable/impl.rb Issue #21708 has been reported by jfi (James Inman). ---------------------------------------- Bug #21708: Ruby 3.4 Forwardable: setter delegations trigger SyntaxError from forwardable/impl.rb https://bugs.ruby-lang.org/issues/21708 * Author: jfi (James Inman) * Status: Open * ruby -v: 3.4.7 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- - `forwardable`: 1.3.3 (bundled stdlib) - OS: Ubuntu 24.04 (also reproducible on macOS) - RUBYOPT / $DEBUG: default (but with $DEBUG=true or RUBYOPT=-d the errors are emitted) # Reproduction Script (minimal) ``` require "forwardable" class Host attr_accessor :scheme end class Delegator extend Forwardable def initialize @host = Host.new end def_delegator :@host, :scheme=, :scheme= def_delegator :@host, :scheme, :scheme end $DEBUG = true # force forwardable to log the SyntaxError d = Delegator.new d.scheme = "https" puts d.scheme ``` Output running with `ruby -d`: ``` Exception 'SyntaxError' at .../forwardable/impl.rb:6 - syntax errors found > 6 | BEGIN{throw tag}; ().scheme= | ^ expected an expression after `=` ``` Despite the `SyntaxError`, the program continues, but stderr is flooded whenever a setter is delegated. Similar errors appear for any delegated setter (`host=`, `port=`, etc.), causing noise in test runs and CI logs. # Expected behavior Delegating setter methods should not raise or log `SyntaxError`; `forwardable` should generate the delegator quietly, as in Ruby 3.3 and earlier. # Other reports - ruby/forwardable issue #35 shows the same SyntaxError output pattern on Ruby 3.4: https://github.com/ruby/forwardable/issues/35 -- 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/