inconsistent Method.arity
-------------------------

                 Key: JRUBY-2325
                 URL: http://jira.codehaus.org/browse/JRUBY-2325
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC3
            Reporter: Jaroslav Libak


Method.arity behaves differently for initialize method. If we create initialize 
method taking 2 parameters, arity will return -1. When we try to create 
instance of this class, we get exception that we didn't supply enough arguments 
which is correct. So I think arity in this case should be 2 as well. Other 
custom method "mymethod" taking 2 parameters returns arity 2.
Please verify how should arity actually behave.

class Test
def initialize(a, b)
end
def mymethod(a, b)
end
end

irb(main):007:0> Test.method(:initialize).arity
=> -1

irb(main):010:0> a = Test.new
ArgumentError: wrong number of arguments(0 for 2)
        from (irb):11:in `initialize'
        from (irb):11:in `new'
        from (irb):11:in `signal_status'


irb(main):011:0> a = Test.new(1, 2)
=> #<Test:0x140d415>
irb(main):012:0> a.method(:mymethod).arity
=> 2


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to