Skip to content
This repository

Fixnum#to_sym is not defined in Ruby 1.9 #261

Merged
merged 1 commit into from over 1 year ago

2 participants

Andy Lindeman Charles Oliver Nutter
Andy Lindeman

In MRI 1.9, Fixnum does not respond to to_sym.

1.9.3-p194 :001 > 1.to_sym
NoMethodError: undefined method `to_sym' for 1:Fixnum
    from (irb):1
    from /Users/alindeman/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

I got pretty confused when trying to write an automated test for this: I don't know if it should be a rubyspec (I haven't had good luck with getting my pull requests merged there) or a JRuby spec (Java or Ruby?). If anyone wants to hold my hand, let me know and I'll gladly try.

Charles Oliver Nutter
Owner

Yeah, good question...I'm not sure either. Since it doesn't seem to fit anywhere else very well (most other suites don't care about testing negative conditions), how about a spec for our spec/regression dir?

Charles Oliver Nutter headius merged commit af7bd1d into from
Charles Oliver Nutter headius closed this
Charles Oliver Nutter
Owner

Actually, don't worry about it...I'll just add one quick.

Charles Oliver Nutter headius referenced this pull request from a commit
Charles Oliver Nutter Spec for #261. 7b55532
Andy Lindeman

Thanks :D

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

Showing 1 unique commit by 1 author.

Aug 09, 2012
Andy Lindeman Fixnum#to_sym is not defined in Ruby 1.9 2b9dedf
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  src/org/jruby/RubyFixnum.java
2  src/org/jruby/RubyFixnum.java
@@ -318,7 +318,7 @@ public IRubyObject id2name() {
318 318
     /** fix_to_sym
319 319
      * 
320 320
      */
321  
-    @JRubyMethod
  321
+    @JRubyMethod(compat = RUBY1_8)
322 322
     public IRubyObject to_sym() {
323 323
         RubySymbol symbol = RubySymbol.getSymbolLong(getRuntime(), value);
324 324
         
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.