diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-12-21 16:46:18 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-12-21 16:46:18 +0100 |
commit | ff6f0d5c38e81f742e1161c1504fc6b8e45d9a1e (patch) | |
tree | 5b38ef43eb96593691588f9605281bd3145628d3 /src/testdir/test_vim9_class.vim | |
parent | cc944b1452547145cdd947a37c75fce695d8571e (diff) |
patch 9.0.2182: Vim9: need a way to reserve future extensionv9.0.2182
Problem: Vim9: need a way to reserve future extension
Solution: reserve double underscore prefix for future use
(Yegappan Lakshmanan)
related: #13238
closes: #13742
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 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index c28716aa1b..e2c61b03b7 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -9659,4 +9659,31 @@ def Test_const_class_object_variable() v9.CheckSourceFailure(lines, 'E1022: Type or initialization required', 3) enddef +" Test for using double underscore prefix in a class/object method name. +def Test_method_double_underscore_prefix() + # class method + var lines =<< trim END + vim9script + class A + static def __foo() + echo "foo" + enddef + endclass + defcompile + END + v9.CheckSourceFailure(lines, 'E1034: Cannot use reserved name __foo()', 3) + + # object method + lines =<< trim END + vim9script + class A + def __foo() + echo "foo" + enddef + endclass + defcompile + END + v9.CheckSourceFailure(lines, 'E1034: Cannot use reserved name __foo()', 3) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |