diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2024-04-01 14:50:41 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-01 14:50:41 +0200 |
commit | 2ed5a11b1a84c86b5392110a81302ae038b5c554 (patch) | |
tree | dc4e61a5243a921e43deb1fbba811ba061aac965 /src/testdir/test_vim9_class.vim | |
parent | 8eb7523802cb51984e2202d08a4fbc1a2cd803c7 (diff) |
patch 9.1.0252: Vim9: segfault with static in super classv9.1.0252
Problem: Vim9: segfault with static in super class
(Ernie Rael)
Solution: When initializing lhs, use the correct class where a class
variable is defined (Yegappan Lakshmanan)
fixes: #14352
closes: #14372
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_vim9_class.vim')
-rw-r--r-- | src/testdir/test_vim9_class.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index f0c6f0cd00..0bc3639305 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -10463,4 +10463,32 @@ def Test_current_class_object_class_member() v9.CheckScriptSuccess(lines) enddef +" Test for updating a base class variable from a base class method without the +" class name. This used to crash Vim (Github issue #14352). +def Test_use_base_class_variable_from_base_class_method() + var lines =<< trim END + vim9script + + class DictKeyClass + static var _obj_id_count = 1 + def _GenerateKey() + _obj_id_count += 1 + enddef + static def GetIdCount(): number + return _obj_id_count + enddef + endclass + + class C extends DictKeyClass + def F() + this._GenerateKey() + enddef + endclass + + C.new().F() + assert_equal(2, DictKeyClass.GetIdCount()) + END + v9.CheckScriptSuccess(lines) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |