Cannot define variables on true/false #145

Closed
tobi opened this Issue Jan 5, 2010 · 3 comments

Projects

None yet

3 participants

@tobi
tobi commented Jan 5, 2010

Code:

  def true.hello
    puts 'y0'
  end
  true.hello

Realworld usage:

github.com/tobi/liquid

Error:

  [~/tmp] ruby test.rb 
  An exception occurred running test.rb
      No method 'attach_method' on TrueClass (Class) (NoMethodError)

  Backtrace:
    Kernel(Class)#attach_method (method_missing) at kernel/delta/kernel.rb:47
                         main.__script__ at test.rb:1
      Rubinius::CompiledMethod#as_script at kernel/common/compiled_method.rb:230
             Requirer::Utils.single_load at kernel/delta/requirer.rb:236
     Requirer::Utils.load_from_extension at kernel/delta/requirer.rb:321
                 Rubinius::Loader#script at kernel/loader.rb:351
                   Rubinius::Loader#main at kernel/loader.rb:466
                       Object#__script__ at kernel/loader.rb:470
  [~/tmp] rvm use ree

  Now using ree 1.8.7 2009.10

  [~/tmp] ruby test.rb 
  y0
@evanphx
Member
evanphx commented Jan 5, 2010

I was unable to repro this on rc2. There was some code changed related to this, so perhaps an old .rbc file caused the issue. Here is the output you should see:

kendall :: git/rbx » bin/rbx compile -B scratch/true.rb 

============= :__script__ ==============
Arguments:   0 required, 0 total
Locals:      0
Stack size:  5
Lines to IP: 1: 0-12, 4: 13-18

0000:  push_const_fast            :Rubinius, 1
0003:  push_literal               :hello
0005:  push_literal               #
0007:  push_scope                 
0008:  push_true                  
0009:  send_stack                 :attach_method, 4
0012:  pop                        
0013:  push_true                  
0014:  send_method                :hello
0016:  pop                        
0017:  push_true                  
0018:  ret                        
----------------------------------------

================ :hello ================
Arguments:   0 required, 0 total
Locals:      0
Stack size:  2
Lines to IP: 1: 0--1, 2: 0-8

0000:  push_self                  
0001:  push_literal               "y0"
0003:  string_dup                 
0004:  allow_private              
0005:  send_stack                 :puts, 1
0008:  ret                        
----------------------------------------
@dbussink
Member
dbussink commented Jan 8, 2010

I checked and can't reproduce either. I'm closing this, please leave a comment if you still see this issue

@tobi
tobi commented Jan 12, 2010

rc 2 indeed fixes this.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment