NUM2DBL(symbol) raises NoMethodError instead of TypeError
---------------------------------------------------------

                 Key: JRUBY-5037
                 URL: http://jira.codehaus.org/browse/JRUBY-5037
             Project: JRuby
          Issue Type: Bug
          Components: Extensions
            Reporter: Jeremy Evans
            Priority: Minor


C Code:

#include <ruby.h>

{noformat} 
static VALUE jsf(VALUE self) {
  return rb_float_new(NUM2DBL(self));
}

void Init_jsf(void) {
  rb_define_method(rb_cSymbol, "jsf", jsf, 0);
}
{noformat} 

MRI output:

{noformat}
$ ruby -r jsf -e ":hello.jsf"
-e:1:in `jsf': can't convert Symbol into Float (TypeError)
        from -e:1
{noformat} 

JRuby output:

{noformat} 
$ ~/jruby/bin/jruby -r jsf.so -e ":hello.jsf"
calling init (1e2527)
-e:1:in `jsf': undefined method `to_f' for :hello:Symbol (NoMethodError)
        from -e:1
{noformat} 
JRuby version:

{noformat} 
$ ~/jruby/bin/jruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-08-23 fa6bc0c) (OpenJDK 
Client VM 1.6.0_18) [i386-java]
{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