Skip to content

Commit 7c87223

Browse files
Fix exception message when calling import_methods without a Module
1 parent 435d102 commit 7c87223

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

core/src/main/java/org/jruby/RubyModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6841,6 +6841,7 @@ public static IRubyObject import_methods(ThreadContext context, IRubyObject self
68416841

68426842
for (IRubyObject _module : modules) {
68436843
RubyModule module = castAsModule(context, _module);
6844+
if (module.getClass() != RubyModule.class) throw typeError(context, "wrong argument type Class (expected Module)");
68446845

68456846
if (module.getSuperClass() != null) {
68466847
warn(context, module.getName(context) + " has ancestors, but Refinement#import_methods doesn't import their methods");
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
fails:Refinement#import_methods doesn't import any methods if one of the arguments is not a module
21
fails:Refinement#import_methods imports methods from multiple modules so that methods see other's module's methods
32
fails:Refinement#import_methods imports methods from module so that methods can see each other
4-
fails:Refinement#import_methods when methods are defined in Ruby code throws an exception when argument is not a module

0 commit comments

Comments
 (0)