Skip to content

Passing a default parameter to a block causes an exception. #4013

@fables-tales

Description

@fables-tales

Environment

Provide at least:

  • JRuby version jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.5-b02 on 1.8.0_05-b13 +jit [darwin-x86_64] no jruby opts.
  • Operating system and platform Darwin Computer-2.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

Originally reported as: rspec/rspec-dev#163

Expected Behavior

Actual Behavior

(master)$ ruby hi_spec.rb
Unhandled Java exception: java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.parser.StaticScope
java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.parser.StaticScope
             cache at org/jruby/ir/instructions/SearchConstInstr.java:82
    processOtherOp at org/jruby/ir/interpreter/StartupInterpreterEngine.java:173
         interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:115
   INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:132
   commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:148
              call at org/jruby/runtime/IRBlockBody.java:66
              call at org/jruby/runtime/Block.java:126
              call at org/jruby/RubyProc.java:342
            call19 at org/jruby/RubyProc.java:326
              call at org/jruby/internal/runtime/methods/DynamicMethod.java:193
              call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
      cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
              call at org/jruby/runtime/callsite/CachingCallSite.java:131
       processCall at org/jruby/ir/interpreter/InterpreterEngine.java:332
         interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
  INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:109
              call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:95
      cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:273
         callBlock at org/jruby/runtime/callsite/CachingCallSite.java:79
              call at org/jruby/runtime/callsite/CachingCallSite.java:83
         interpret at org/jruby/ir/instructions/CallBase.java:423
       processCall at org/jruby/ir/interpreter/InterpreterEngine.java:348
         interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
    INTERPRET_ROOT at org/jruby/ir/interpreter/Interpreter.java:112
           execute at org/jruby/ir/interpreter/Interpreter.java:99
           execute at org/jruby/ir/interpreter/Interpreter.java:35
           execute at org/jruby/ir/IRTranslator.java:42
    runInterpreter at org/jruby/Ruby.java:868
    runInterpreter at org/jruby/Ruby.java:873
       runNormally at org/jruby/Ruby.java:765
       runFromMain at org/jruby/Ruby.java:579
     doRunFromMain at org/jruby/Main.java:425
       internalRun at org/jruby/Main.java:313
               run at org/jruby/Main.java:242
              main at org/jruby/Main.java:204

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions