summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-04-09 21:39:27 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-09 21:39:27 +0200
commit1af0fbf955f799392f614bc38f9d2fcbd9960526 (patch)
tree723f030d699f218b549d22b241115436823e4a04 /src/testdir
parent78c51500f1bb16501521d721d52cb0982f5e70b6 (diff)
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methodsv9.1.0286
Problem: Vim9: E1027 with defcompile for abstract methods with non-void return types, but still compiles it (zzzyxwvut) Solution: Don't compile abstract methods (Yegappan Lakshmanan) fixes: #14443 closes: #14447 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_vim9_class.vim42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 77a2102c2d..6d6d178510 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -10583,4 +10583,46 @@ def Test_lambda_block_in_class()
v9.CheckScriptSuccess(lines)
enddef
+" Test for defcompiling an abstract method
+def Test_abstract_method_defcompile()
+ # Compile an abstract class with abstract object methods
+ var lines =<< trim END
+ vim9script
+ abstract class A
+ abstract def Foo(): string
+ abstract def Bar(): list<string>
+ endclass
+ defcompile
+ END
+ v9.CheckScriptSuccess(lines)
+
+ # Compile a concrete object method in an abstract class
+ lines =<< trim END
+ vim9script
+ abstract class A
+ abstract def Foo(): string
+ abstract def Bar(): list<string>
+ def Baz(): string
+ pass
+ enddef
+ endclass
+ defcompile
+ END
+ v9.CheckScriptFailure(lines, 'E476: Invalid command: pass', 1)
+
+ # Compile a concrete class method in an abstract class
+ lines =<< trim END
+ vim9script
+ abstract class A
+ abstract def Foo(): string
+ abstract def Bar(): list<string>
+ static def Baz(): string
+ pass
+ enddef
+ endclass
+ defcompile
+ END
+ v9.CheckScriptFailure(lines, 'E476: Invalid command: pass', 1)
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker