Mercurial > vim
diff src/testdir/test_vim9_class.vim @ 31740:22a4824d7964 v9.0.1202
patch 9.0.1202: crash when iterating over list of objects
Commit: https://github.com/vim/vim/commit/f450804e1438307c79a62053f8c32eef1508383a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 15 16:54:57 2023 +0000
patch 9.0.1202: crash when iterating over list of objects
Problem: Crash when iterating over list of objects.
Solution: Do not make a copy of tt_member for object or class.
(closes #11823)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 15 Jan 2023 18:00:03 +0100 |
parents | ad0712119bee |
children | 1b2bde0c64f2 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -219,6 +219,27 @@ def Test_assignment_with_operator() v9.CheckScriptSuccess(lines) enddef +def Test_list_of_objects() + var lines =<< trim END + vim9script + + class Foo + def Add() + enddef + endclass + + def ProcessList(fooList: list<Foo>) + for foo in fooList + foo.Add() + endfor + enddef + + var l: list<Foo> = [Foo.new()] + ProcessList(l) + END + v9.CheckScriptSuccess(lines) +enddef + def Test_class_default_new() var lines =<< trim END vim9script