Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3afa8b15512d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7c77dbb26b42
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Dec 31, 2017

  1. Raise TypeError if module_function is not called for modules

    For example, these code calls module_function for Class:
    
    ```
    Module.instance_method(:module_function).bind(Class.new).call(:foo)
    ```
    
    This commit will fix `TestClass#test_module_function`.
    yui-knk committed Dec 31, 2017
    Copy the full SHA
    227a8a2 View commit details

Commits on Jan 2, 2018

  1. Merge pull request #4927 from yui-knk/test_module_function

    Raise `TypeError` if `module_function` is not called for modules
    enebo authored Jan 2, 2018
    Copy the full SHA
    7c77dbb View commit details
Showing with 4 additions and 1 deletion.
  1. +4 −0 core/src/main/java/org/jruby/RubyModule.java
  2. +0 −1 test/mri/excludes/TestClass.rb
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2781,6 +2781,10 @@ public RubyModule rbPrivate(ThreadContext context, IRubyObject[] args) {
public RubyModule module_function(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.runtime;

if (!isModule()) {
throw context.runtime.newTypeError("module_function must be called for modules");
}

if (args.length == 0) {
context.setCurrentVisibility(MODULE_FUNCTION);
} else {
1 change: 0 additions & 1 deletion test/mri/excludes/TestClass.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
exclude :test_extend_object, "needs investigation"
exclude :test_invalid_jump_from_class_definition, "needs investigation"
exclude :test_method_redefinition, "needs investigation"
exclude :test_module_function, "needs investigation"
exclude :test_redefine_private_class, "needs investigation"
exclude :test_redefinition_mismatch, "parser issue with Japanese identifiers (#3679)"
exclude :test_singleton_class_message, "error says object instead of Class"