Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty intern array (%i[]) does not work #3060

Closed
rejeep opened this Issue Jun 17, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@rejeep
Copy link

rejeep commented Jun 17, 2015

Hey guys,

Ran into this little bug today:

JRUBY_OPTS=--1.9 jirb
jruby-1.7.19 :001 > %i[]
SyntaxError: (irb):1: unknown type of %string
%i[]
  ^
    from org/jruby/RubyKernel.java:1107:in `eval'
    from org/jruby/RubyKernel.java:1507:in `loop'
    from org/jruby/RubyKernel.java:1270:in `catch'
    from org/jruby/RubyKernel.java:1270:in `catch'
    from /Users/rejeep/.rvm/rubies/jruby-1.7.19/bin/jirb:13:in `(root)'
JRUBY_OPTS=--2.0 jirb
jruby-1.7.19 :001 > %i[]
Java::JavaLang::ClassCastException: org.jruby.ast.ZArrayNode cannot be cast to org.jruby.ast.ListNode
    from org.jruby.parser.Ruby20Parser$180.execute(Ruby20Parser.java:2863)
    from org.jruby.parser.Ruby20Parser.yyparse(Ruby20Parser.java:1575)
    from org.jruby.parser.Ruby20Parser.yyparse(Ruby20Parser.java:1466)
    from org.jruby.parser.Ruby20Parser.parse(Ruby20Parser.java:4640)
    from org.jruby.parser.Parser.parse(Parser.java:114)
    from org.jruby.parser.Parser.parse(Parser.java:84)
    from org.jruby.parser.Parser.parse(Parser.java:76)
    from org.jruby.Ruby.parseEval(Ruby.java:2711)
    from org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:176)
    from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1144)
    from org.jruby.RubyKernel.eval19(RubyKernel.java:1107)
    from org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call(RubyKernel$INVOKER$s$0$3$eval19.gen)
    from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:180)
    from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:296)
    from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:72)
    from org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
... 117 levels...
    from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
    from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:203)
    from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
    from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
    from Users.rejeep.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_19.bin.jirb.__file__(/Users/rejeep/.rvm/rubies/jruby-1.7.19/bin/jirb:13)
    from Users.rejeep.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_19.bin.jirb.load(/Users/rejeep/.rvm/rubies/jruby-1.7.19/bin/jirb)
    from org.jruby.Ruby.runScript(Ruby.java:866)
    from org.jruby.Ruby.runScript(Ruby.java:859)
    from org.jruby.Ruby.runNormally(Ruby.java:728)
    from org.jruby.Ruby.runFromMain(Ruby.java:577)
    from org.jruby.Main.doRunFromMain(Main.java:395)
    from org.jruby.Main.internalRun(Main.java:290)
    from org.jruby.Main.run(Main.java:217)
    from org.jruby.Main.main(Main.java:197)jruby-1.7.19 :002 >

Installed via Rvm, running on OSX. Not sure what kind of additional debug information you might be interested in? Let me know if there's anything missing.

@enebo enebo added the JRuby 9000 label Jun 17, 2015

@enebo enebo added this to the JRuby 9.0.0.0.rc2 milestone Jun 17, 2015

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Jun 17, 2015

I am swapping this to be a 9000 bug since we are behaving correctly for --1.9 mode and --2.0 mode was experimental and we probably will not fix this there. This bug does still occur in 9k so we will fix for rc2 (and possibly backport to 1.7.x --2.0 mode if super trivial).

@rejeep

This comment has been minimized.

Copy link
Author

rejeep commented Jun 17, 2015

we are behaving correctly for --1.9 mode

How so? In MRI:

$ irb
2.2.1 :001 > %i[]
 => []
@enebo

This comment has been minimized.

Copy link
Member

enebo commented Jun 17, 2015

mri19 -ve '%i{}'
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin13.4.0]
-e:1: unknown type of %string
@rejeep

This comment has been minimized.

Copy link
Author

rejeep commented Jun 17, 2015

Ahh, sorry, was running that in 2.0, thought I was using 1.9.

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Jun 17, 2015

No problem. I already fixed this on master so I might fix it for --2.0 on 1.7 since it was really trivial.

@rejeep

This comment has been minimized.

Copy link
Author

rejeep commented Jun 17, 2015

Thanks! 👍

@enebo enebo closed this in 9651a3a Jun 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.