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

Also available in: Atom PDF

Like0
Like0Like0Like0