Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:Kernel#define_singleton_method when given an UnboundMethod defines any Child class method from any Parent's class methods
fails:Kernel#define_singleton_method when given an UnboundMethod will raise when attempting to define an object's singleton method from another object's singleton method
Original file line number Diff line number Diff line change
@@ -972,9 +972,15 @@ public RubySymbol defineMethod(RubyModule module, String name, RubyMethod method
}

@Specialization
public RubySymbol defineMethod(RubyModule module, String name, RubyUnboundMethod method, UndefinedPlaceholder block) {
public RubySymbol defineMethod(VirtualFrame frame, RubyModule module, String name, RubyUnboundMethod method, UndefinedPlaceholder block) {
notDesignedForCompilation();

if (module instanceof RubyClass && !ModuleOperations.assignableTo((RubyClass) module, method.getOrigin())) {
ruby(frame, "raise TypeError, 'bind argument must be a subclass of " + method.getOrigin().getName() + "'");
}

// TODO CS 5-Apr-15 TypeError if the method came from a singleton

module.addMethod(this, method.getMethod().withNewName(name));

return getContext().getSymbolTable().getSymbol(name);

0 comments on commit 5844ccd

Please sign in to comment.