Skip to content


Fixnum#to_sym is not defined in Ruby 1.9 #261

merged 1 commit into from

2 participants


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.

JRuby Team member

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?

@headius headius merged commit af7bd1d into jruby:master
JRuby Team member

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

@headius headius added a commit that referenced this pull request
@headius headius Spec for #261. 7b55532

Thanks :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 10, 2012
  1. @alindeman
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/org/jruby/
2 src/org/jruby/
@@ -318,7 +318,7 @@ public IRubyObject id2name() {
/** fix_to_sym
- @JRubyMethod
+ @JRubyMethod(compat = RUBY1_8)
public IRubyObject to_sym() {
RubySymbol symbol = RubySymbol.getSymbolLong(getRuntime(), value);
Something went wrong with that request. Please try again.