#312 √ resolved
Le Huy

[BUG] modify Object#instance_variables results in wrong compilation "defined?(@iv)"

Reported by Le Huy | February 8th, 2008 @ 03:37 AM | in 1.0 preview

huy@huy-desktop:/u01/rubinius/try$ ../code/shotgun/rubinius
irb(main):001:0> class A
irb(main):002:1> 
irb(main):003:1*   def instance_variables
irb(main):004:2>       super - ['@a']
irb(main):005:2>   end
irb(main):006:1> 
irb(main):007:1*   def m
irb(main):008:2>      return @a if defined?(@a)
irb(main):009:2>      "a"
irb(main):010:2>   end
irb(main):011:1> 
irb(main):012:1* end
=> #<CompiledMethod:0x400e1 name=m file=(irb)>
irb(main):013:0> 
irb(main):014:0* puts A.new.m
ArgumentError: wrong number of arguments (got 1, required 0)
   from A#instance_variables at (irb):3
   from A#m at (irb):8
   from Object#irb_binding {} at (irb):14

Comments and changes to this ticket

  • Le Huy

    Le Huy February 9th, 2008 @ 01:43 AM

      • → Title changed from “[BUG] modify Object#instance_variables results in wrong compilation” to “[BUG] modify Object#instance_variables results in wrong compilation "defined?(@iv)"”
  • Wilson Bilkovich

    Wilson Bilkovich February 27th, 2008 @ 12:22 PM

      • → Milestone cleared.
      • → State changed from “new” to “open”
      • → Assigned user changed from “” to “Wilson Bilkovich”

    Rubinius has a different arity for Object#instance_variables than MatzRuby, which is what causes this.

    It is fixable, but I am going to move the milestone to after the 1.0 preview.

    Thanks for the report.

  • Le Huy

    Le Huy February 27th, 2008 @ 07:34 PM

    But you must choose between fix RbYAML and fix Rubinius Core. The example is extracted from RbYAML code and alot of other libs depend on YAML

  • Wilson Bilkovich

    Wilson Bilkovich February 27th, 2008 @ 09:09 PM

      • → Milestone changed from “” to “1.0 preview”

    Aah. In that case, this is indeed in 1.0 territory.

  • Wilson Bilkovich

    Wilson Bilkovich February 27th, 2008 @ 11:12 PM

      • → State changed from “open” to “resolved”

    Fixed in the main repo as of 04:10 UTC 2008-02-28.

    Thanks.

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 »

People watching this ticket