Bug in 1.8.7-p249, the version shipped with Ubuntu 10.04

I recently upgraded from 1.8.7-p72 to 1.8.7-p249 and a piece of code
that I had long relied on stopped working. Here is an example of the
issue:

  class X
    def q; "q"; end
  end

  class Y < X
    def q
      f do
        super()
      end
    end
    def f(&b)
      b.call
    end
  end

  y = Y.new
  y.q

  NoMethodError: super called outside of method
  from (irb):7
  from (irb):11:in `call'
  from (irb):11:in `f'
  from (irb):6:in `q'
  from (irb):15

I tried this on 1.9.2 and it works so I am assuming this is a bug with
p249?

Hello,

(2010/10/01 22:39), Intransition wrote:

  NoMethodError: super called outside of method
  from (irb):7
  from (irb):11:in `call'
  from (irb):11:in `f'
  from (irb):6:in `q'
  from (irb):15

I tried this on 1.9.2 and it works so I am assuming this is a bug with
p249?

Yes and fixed already. Try a newer patchlevel.

Would you mind reporting this as a bug on
Bugs : ruby1.8 package : Ubuntu ?

I'll try to take it from there.

- Lucas

···

On 01/10/10 at 22:39 +0900, Intransition wrote:

I recently upgraded from 1.8.7-p72 to 1.8.7-p249 and a piece of code
that I had long relied on stopped working. Here is an example of the
issue:

  class X
    def q; "q"; end
  end

  class Y < X
    def q
      f do
        super()
      end
    end
    def f(&b)
      b.call
    end
  end

  y = Y.new
  y.q

  NoMethodError: super called outside of method
  from (irb):7
  from (irb):11:in `call'
  from (irb):11:in `f'
  from (irb):6:in `q'
  from (irb):15

I tried this on 1.9.2 and it works so I am assuming this is a bug with
p249?

Thanks. I was hoping the Debian/Ubuntu package maintainer would get
wind of it by posting it to ruby-talk.

Interestingly I was looking for someone to contact and came across
this blog post.

  Ruby packaging in Debian and Ubuntu: Mythbusting and FAQ – Lucas Nussbaum's Blog

···

On Oct 1, 11:06 am, Urabe Shyouhei <shyou...@ruby-lang.org> wrote:

Hello,

(2010/10/01 22:39), Intransition wrote:
> NoMethodError: super called outside of method
> from (irb):7
> from (irb):11:in `call'
> from (irb):11:in `f'
> from (irb):6:in `q'
> from (irb):15

> I tried this on 1.9.2 and it works so I am assuming this is a bug with
> p249?

Yes and fixed already. Try a newer patchlevel.