Project

General

Profile

Actions

Bug #20720

closed

prism incorrectly marks SuperNode as forwarding in some cases

Added by luke-gru (Luke Gruber) 3 months ago. Updated 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:119096]

Description

class A
  def foo(*b, &block)
  end
end

class B < A
  def foo(...)
    super()
    puts "2"
  end
end

results in:

./ruby --parser=prism -I../ruby/lib -I. -I.ext/x86_64-linux -I.ext/common -r./x86_64-linux-fake ../ruby/test.rb

-- raw disasm--------

   trace: 8

   trace: 1

 <L000> [sp: 0, unremovable: 0, refcnt: 0]

   0000 putself                                                          ( 284)

   0001 invokesuperforward   <calldata:, 0>, nil                         ( 284)

*  0004 pop                                                              ( 284)

   trace: 1

   0005 putself                                                          ( 285)

   0006 putchilledstring     "2"                                         ( 285)

   0008 opt_send_without_block <calldata:puts, 1>                        ( 285)

   trace: 10

   0010 leave                                                            ( 286)

---------------------

../ruby/test.rb: ../ruby/test.rb:284: argument stack underflow (-1) (SyntaxError)

It should differentiate between forwarding nodes and non-ZSUPER Super nodes with no arguments.

Actions #1

Updated by luke-gru (Luke Gruber) 3 months ago

  • Description updated (diff)
Actions #3

Updated by luke-gru (Luke Gruber) 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|5d358b660d41e64de301f428dc0300a52a6f9566.


Fix issue with super and forwarding arguments in prism_compile.c

Fixes [Bug #20720]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0