Skip to content

Commit 98b6604

Browse files
authored
Merge pull request jruby#9206 from evaniainbrooks/8876-exception-message
Fix exception message when calling import_methods without a Module
2 parents 39ba94f + 7c87223 commit 98b6604

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
@@ -6850,6 +6850,7 @@ public static IRubyObject import_methods(ThreadContext context, IRubyObject self
68506850

68516851
for (IRubyObject _module : modules) {
68526852
RubyModule module = castAsModule(context, _module);
6853+
if (module.getClass() != RubyModule.class) throw typeError(context, "wrong argument type Class (expected Module)");
68536854

68546855
if (module.getSuperClass() != null) {
68556856
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)