• Yukihiro "Matz" Matsumoto's avatar
    The superclass info should be taken from `TARGET_CLASS(ci->proc). · d0f60182
    Yukihiro "Matz" Matsumoto authored
    Not from `ci->target_class` that may be switched using `class_eval` etc.
    fix #3899, fix #3906
    
    We found out there is a mruby specific limitation that `super` may be
    screwed up when a method is defined in a module and `super` is called
    in the block with the target class switched (for example, `super` in
    `class_eval` block).  Now we raise `RuntimeError` for such cases.
    
    The following code works in CRuby but not in mruby.
    ```
    module M
      def foo
        "aaa".singleton_class.class_eval{super 2}
      end
    end
    class Foo
      def foo(*); end
    end
    class Bar<Foo
      include M
    end
    Bar.new.foo
    ```
    d0f60182
vm.c 76.4 KB