Permalink
Browse files

Kernel#singleton_methods should return a unique list of methods

  • Loading branch information...
1 parent d90f2db commit 2997b7ae0c48693c7b5d1c6bdaa9690603b9ccbe @atambo committed May 5, 2013
@@ -1,6 +0,0 @@
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for an object extended with a module
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for a subclass
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for a subclass including a module
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for an object extended with a module
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for a subclass
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for a subclass including a module
@@ -1,6 +0,0 @@
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for an object extended with a module
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for a subclass
-fails(JRUBY-5660):Kernel#singleton_methods when not passed an argument returns a unique list for a subclass including a module
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for an object extended with a module
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for a subclass
-fails(JRUBY-5660):Kernel#singleton_methods when passed true returns a unique list for a subclass including a module
@@ -2540,10 +2540,9 @@ private RubyArray singletonMethods(ThreadContext context, IRubyObject[] args, Me
all = args[0].isTrue();
}
- RubyArray singletonMethods;
if (getMetaClass().isSingleton()) {
IRubyObject[] methodsArgs = new IRubyObject[]{context.runtime.getFalse()};
- singletonMethods = collect.instanceMethods(getMetaClass(), methodsArgs);
+ RubyArray singletonMethods = collect.instanceMethods(getMetaClass(), methodsArgs);
if (all) {
RubyClass superClass = getMetaClass().getSuperClass();
@@ -2552,11 +2551,12 @@ private RubyArray singletonMethods(ThreadContext context, IRubyObject[] args, Me
superClass = superClass.getSuperClass();
}
}
- } else {
- singletonMethods = context.runtime.newEmptyArray();
+
+ singletonMethods.uniq_bang(context);
+ return singletonMethods;
}
- return singletonMethods;
+ return context.runtime.newEmptyArray();
}
private abstract static class MethodsCollector {

0 comments on commit 2997b7a

Please sign in to comment.