Skip to content

fails to call superclass of wrapped method #6098

Closed

Description

@jabamaus
module Wrapper
  def wrap(meth)
    define_method(meth) do |*args, **kwargs, &block|
      super(*args, **kwargs, &block)
      puts "side effect"
      self
    end
  end
end

class MyString < String
  extend Wrapper
  wrap :<<
end


MyString.new << "a"

This code prints 'side effect' in cruby but with mruby I get

test.rb:4:in <<: no superclass method 'wrap' (NoMethodError)

What's going on here? This is with latest mruby head.

Thanks :)

Activity

  1. matz commented on Nov 7, 2023

    @matz
    Member

    It is a bug. But it may take time to fix the issue. Stay tuned, please.

  2. jabamaus commented on Nov 7, 2023

    @jabamaus
    Author

    No problem. I think the problem got introduced in the past few months as I'm sure I've seen this working.

  3. added a commit that references this issue on Feb 7, 2024
    91b4da3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions