Skip to content

Loading…

Fixnum#to_sym is not defined in Ruby 1.9 #261

Merged
merged 1 commit into from

2 participants

@alindeman

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.

@headius
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
@headius
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
@alindeman

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/RubyFixnum.java
View
2 src/org/jruby/RubyFixnum.java
@@ -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.