calling yield in a three-argument function causes an NPE in the compiler.
-------------------------------------------------------------------------

                 Key: JRUBY-2697
                 URL: http://jira.codehaus.org/browse/JRUBY-2697
             Project: JRuby
          Issue Type: Bug
          Components: Compiler
    Affects Versions: JRuby 1.1.2
         Environment: OS X 10.4.11 using Apple's 1.5.0 JDK, everything with 
latest patches (as of 6/23/2008)
            Reporter: Philip Smith
         Attachments: bug.rb

This script causes a NPE when the compiler is not disabled with -X-C:

{noformat}
# bug.rb
# Runs fine with -X-C

def thisHasToHaveExactlyThreeArgs(a, b, c)
  yield
end

puts thisHasToHaveExactlyThreeArgs(:a, :b, :c) { 'Fixed!' }
{noformat}

If the function is defined to take 0, 1, 2, 4 or 5 arguments, the script prints 
'Fixed!' as expected.

I can't reproduce this on jruby 1.1.1.

The stack trace:

{noformat}
frontalot:~ $ jruby bug.rb
Exception in thread "main" java.lang.NullPointerException
        at 
ruby.Users.philhsmith.bug.method__0$RUBY$thisHasToHaveExactlyThreeArgs(bug.rb:5)
        at 
ruby.Users.philhsmith.bugInvokermethod__0$RUBY$thisHasToHaveExactlyThreeArgsFixed3.call(Unknown
 Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:235)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:414)
        at ruby.Users.philhsmith.bug.__file__(bug.rb:8)
        at ruby.Users.philhsmith.bug.__file__(bug.rb)
        at ruby.Users.philhsmith.bug.load(bug.rb)
        at org.jruby.Ruby.runScript(Ruby.java:512)
        at org.jruby.Ruby.runNormally(Ruby.java:432)
        at org.jruby.Ruby.runFromMain(Ruby.java:312)
        at org.jruby.Main.run(Main.java:144)
        at org.jruby.Main.run(Main.java:89)
        at org.jruby.Main.main(Main.java:80)
frontalot:~ $ jruby -X-C bug.rb
Fixed!
frontalot:~ $ 
{noformat}


-- 
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