diff options
author | Ernie Rael <errael@raelity.com> | 2023-03-03 15:05:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-03-03 15:05:30 +0000 |
commit | f77a7f704ffd0ca1050e82f609c8b8bd61863277 (patch) | |
tree | 6b7a7b0aa8b48066a9d2661deb86e29da02ac554 /src/testdir | |
parent | c727b19e9f1df36e44321d933334c7b4961daa54 (diff) |
patch 9.0.1375: crash when getting member of obj of unknown classv9.0.1375
Problem: Crash when getting member of obj of unknown class.
Solution: Check for NULL class and give an error message. (Ernie Rael,
closes #12096)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_class.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index c228f2642b..bc8a8e1d54 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -272,6 +272,25 @@ def Test_object_not_set() echo Colorscheme.new(bg).GetBackground() END v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object<Background> but got object<Unknown>') + + # TODO: this should not give an error but be handled at runtime + lines =<< trim END + vim9script + + class Class + this.id: string + def Method1() + echo 'Method1' .. this.id + enddef + endclass + + var obj = null_object + def Func() + obj.Method1() + enddef + Func() + END + v9.CheckScriptFailure(lines, 'E1363:') enddef def Test_class_member_initializer() |