#368 √ resolved
manveru

[BUG] Kernel#loop{} raises if Block has no content.

Reported by manveru | February 27th, 2008 @ 12:01 AM | in 1.0 preview

Kernel#loop{} raises if Block has no content.

See following for backtrace and how to reproduce, hope the formatting will work.

./shotgun/rubinius -e 'loop{ }'
Bytecode generation error:
   No method 'bytecode' on an instance of NilClass. (NoMethodError)
   near (eval):1

    Kernel(NilClass)#bytecode (method_missing_cv) at kernel/core/kernel.rb:607
               Compiler::Node::Loop#bytecode at lib/compiler/bytecode.rb:587
            Compiler::Node::Newline#bytecode at lib/compiler/bytecode.rb:155
    Compiler::Node::Expression(Compiler::Node::EvalExpression)#bytecode {} at lib/compiler/bytecode.rb:126
                                   Proc#call at kernel/core/proc.rb:84
                                Compiler#set at lib/compiler/compiler.rb:243
    Compiler::Node(Compiler::Node::EvalExpression)#set at lib/compiler/nodes.rb:67
    Compiler::Node::Expression(Compiler::Node::EvalExpression)#bytecode at lib/compiler/bytecode.rb:124
     Compiler::Node::EvalExpression#bytecode at lib/compiler/bytecode.rb:134
                     Compiler::Generator#run at lib/compiler/generator.rb:70
             Compiler::MethodDescription#run at lib/compiler/bytecode.rb:21
    Compiler::Node::ClosedScope(Compiler::Node::EvalExpression)#to_description {} at lib/compiler/bytecode.rb:59
                                   Proc#call at kernel/core/proc.rb:84
                        Compiler#show_errors at lib/compiler/compiler.rb:260
    Compiler::Node(Compiler::Node::EvalExpression)#show_errors at lib/compiler/bytecode.rb:44
    Compiler::Node::ClosedScope(Compiler::Node::EvalExpression)#to_description at lib/compiler/bytecode.rb:58
                     Compiler.compile_string at lib/compiler/compiler.rb:48
                      Compile.compile_string at kernel/core/compile.rb:69
                         Kernel(Module)#eval at kernel/core/eval.rb:86
                             Compile.execute at kernel/core/compile.rb:73
                           Object#__script__ at kernel/loader.rb:164
An exception has occurred:
    unable to generate bytecode (Compiler::GenerationError)

Backtrace:
                        Compiler#show_errors at lib/compiler/compiler.rb:262
    Compiler::Node(Compiler::Node::EvalExpression)#show_errors at lib/compiler/bytecode.rb:44
    Compiler::Node::ClosedScope(Compiler::Node::EvalExpression)#to_description at lib/compiler/bytecode.rb:58
                     Compiler.compile_string at lib/compiler/compiler.rb:48
                      Compile.compile_string at kernel/core/compile.rb:69
                         Kernel(Module)#eval at kernel/core/eval.rb:86
                             Compile.execute at kernel/core/compile.rb:73
                           Object#__script__ at kernel/loader.rb:257
zsh: exit 1     ./shotgun/rubinius -e 'loop{ }'

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »