Skip to content

Calling to_sexp on nil while generating sexp for Rubinius::AST::When under 1.9 #2076

Closed
mbj opened this Issue Dec 4, 2012 · 1 comment

1 participant

@mbj
mbj commented Dec 4, 2012

Reproduction:

mbj@mbj ~/devel/rubinius (master*) % cat crash.rb 
case foo
when *STUFF
end
mbj@mbj ~/devel/rubinius (master*) % RBXOPT=-X18 ruby compile -S crash.rb 
[:script,
 [:case,
  [:call, nil, :foo, nil],
  [:whens, [:when, [:array, [:when, [:const, :STUFF], nil]], [:nil]]],
  nil]]
mbj@mbj ~/devel/rubinius (master*) % RBXOPT=-X19 ruby compile -S crash.rb
Failed compiling crash.rb
An exception occurred running compile
    undefined method `to_sexp' on nil:NilClass. (NoMethodError)

Backtrace:
                           Kernel(NilClass)#to_sexp (method_missing) at kernel/delta/kernel.rb:81
                                         Rubinius::AST::When#to_sexp at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/ast/control_flow.rbc:187
     { } in Rubinius::AST::Case(Rubinius::AST::ReceiverCase)#to_sexp at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/ast/control_flow.rbc:38
                                                           Array#map at kernel/bootstrap/array19.rb:18
            Rubinius::AST::Case(Rubinius::AST::ReceiverCase)#to_sexp at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/ast/control_flow.rbc:38
             Rubinius::AST::Container(Rubinius::AST::Script)#to_sexp at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/ast/definitions.rbc:972
                                 Rubinius::Compiler::SexpPrinter#run at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/printers.rbc:22
  Rubinius::Compiler::Stage(Rubinius::Compiler::FileParser)#run_next at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:53
      Rubinius::Compiler::Parser(Rubinius::Compiler::FileParser)#run at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:210
                                              Rubinius::Compiler#run at /home/mbj/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:374
                                 { } in CompilerScript#compile_files at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:210
                                              CompilerScript#protect at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:151
                                 { } in CompilerScript#compile_files at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:202
                                                          Array#each at kernel/bootstrap/array.rb:68
                                        CompilerScript#compile_files at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:192
                                                 CompilerScript#main at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:243
                                                   Object#__script__ at /home/mbj/.rvm/rubies/rbx-head/lib/bin/compile.rb:247
                                    Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:68
                                    Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:118
                                             Rubinius::Loader#script at kernel/loader.rb:615
                                               Rubinius::Loader#main at kernel/loader.rb:816
@mbj
mbj commented Dec 4, 2012

Sorry, I forgot: I'm on latest master, a9a40fc.

@txus txus closed this in 146fc73 Apr 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.