Mercurial > vim
comparison src/testdir/test_vim9_class.vim @ 32812:57282f1d9e0f v9.0.1720
patch 9.0.1720: Vim9 class using wrong index for overridden method
Commit: https://github.com/vim/vim/commit/a456b12011569be91418bbf6277d844c67e05e79
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Wed Aug 16 20:14:37 2023 +0200
patch 9.0.1720: Vim9 class using wrong index for overridden method
Problem: Vim9 class using wrong index for overridden method
Solution: Use correct index for overridden method
closes: #12524
closes: #12813
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 16 Aug 2023 20:51:32 +0200 |
parents | 0dc750a24875 |
children | b3a42579bb3f |
comparison
equal
deleted
inserted
replaced
32811:c2c84e9b90ed | 32812:57282f1d9e0f |
---|---|
1946 assert_true(prop_register_called) | 1946 assert_true(prop_register_called) |
1947 END | 1947 END |
1948 v9.CheckScriptSuccess(lines) | 1948 v9.CheckScriptSuccess(lines) |
1949 enddef | 1949 enddef |
1950 | 1950 |
1951 " Test for calling a method in the parent class that is extended partially. | |
1952 " This used to fail with the 'E118: Too many arguments for function: Text' error | |
1953 " message (Github issue #12524). | |
1954 def Test_call_method_in_parent_class() | |
1955 var lines =<< trim END | |
1956 vim9script | |
1957 | |
1958 class Widget | |
1959 this._lnum: number = 1 | |
1960 | |
1961 def SetY(lnum: number) | |
1962 this._lnum = lnum | |
1963 enddef | |
1964 | |
1965 def Text(): string | |
1966 return '' | |
1967 enddef | |
1968 endclass | |
1969 | |
1970 class Foo extends Widget | |
1971 def Text(): string | |
1972 return '<Foo>' | |
1973 enddef | |
1974 endclass | |
1975 | |
1976 def Stack(w1: Widget, w2: Widget): list<Widget> | |
1977 w1.SetY(1) | |
1978 w2.SetY(2) | |
1979 return [w1, w2] | |
1980 enddef | |
1981 | |
1982 var foo1 = Foo.new() | |
1983 var foo2 = Foo.new() | |
1984 var l = Stack(foo1, foo2) | |
1985 END | |
1986 v9.CheckScriptSuccess(lines) | |
1987 enddef | |
1988 | |
1951 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 1989 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |