New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refinements causes "ArgumentError: tried to create Proc object without a block" #3796

Closed
andy-twosticks opened this Issue Apr 12, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@andy-twosticks

Environment

%: ruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d OpenJDK 64-Bit Server VM 24.91-b01 on 1.7.0_91-mockbuild_2015_11_20_16_53-b00 +jit [linux-amd64]

%: uname -a
Linux centos7andy.jhallpr.com 3.10.0-327.4.4.el7.x86_64 #1 SMP Tue Jan 5 16:07:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Example code appears to trigger the behaviour in plain jRuby without any gems being required.

Expected Behavior

I should get the same behaviour in MRI and jRuby -- the example program should not raise ArgumentError.

Example program:

module RubyPatches
  refine String do
    def does_nothing; self; end
  end   
end

module Ffile
  extend self
  using RubyPatches  # comment out this line to make the ArgumentError go away

  def fall_over
    proc {|a| a }
  end
end

Ffile.fall_over

Actual Behavior

ArgumentError: tried to create Proc object without a block
       proc at org/jruby/RubyKernel.java:1275
  fall_over at ffile3.rb:16
      <top> at ffile3.rb:23
@andy-twosticks

This comment has been minimized.

Show comment
Hide comment
@andy-twosticks

andy-twosticks Apr 12, 2016

Also, I can't but think that this is part of the same issue (although I'm happy to raise it as a seperate ticket if someone wants me to):

Code:

module RubyPatches
  refine String do
    def does_nothing; self; end
  end
end

module Ffile
  using RubyPatches

  FAILY = Struct.new(:one, :two)
end

...and, we run it and we get:

ArgumentError: wrong number of arguments (0 for 1)
  <module:Ffile> at ffile4.rb:14
           <top> at ffile4.rb:10

Also, I can't but think that this is part of the same issue (although I'm happy to raise it as a seperate ticket if someone wants me to):

Code:

module RubyPatches
  refine String do
    def does_nothing; self; end
  end
end

module Ffile
  using RubyPatches

  FAILY = Struct.new(:one, :two)
end

...and, we run it and we get:

ArgumentError: wrong number of arguments (0 for 1)
  <module:Ffile> at ffile4.rb:14
           <top> at ffile4.rb:10
@andy-twosticks

This comment has been minimized.

Show comment
Hide comment
@andy-twosticks

andy-twosticks Apr 12, 2016

Might be a duplicate of #2977 ?

Might be a duplicate of #2977 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment