Source this script:
vim9script
class Widget
this._lnum: number = 1
def SetY(lnum: number)
this._lnum = lnum
enddef
def Text(): string
return ''
enddef
endclass
class Foo extends Widget
# def SetY(lnum: number)
# this._lnum = lnum
# enddef
def Text(): string
return '<Foo>'
enddef
endclass
def Stack(w1: Widget, w2: Widget): list<Widget>
w1.SetY(1)
w2.SetY(2)
return [w1, w2]
enddef
var foo1 = Foo.new()
var foo2 = Foo.new()
echo Stack(foo1, foo2)
This results in E118: Too many arguments for function: Text. A workaround consists in overriding the other method (uncomment the commented code). The code executes without errors also when the Text() method is removed from the subclass (but that is not a practical workaround).
The code snippet above should compile and run without errors.
9.0.1626
macOS 13.4
Apple Terminal
xterm-256color
ZSH 5.9
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #12524 as completed via a456b12.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()