Mercurial > vim
comparison src/testdir/test_vim9_class.vim @ 34834:d3127b18fe1e v9.1.0286
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methods
Commit: https://github.com/vim/vim/commit/1af0fbf955f799392f614bc38f9d2fcbd9960526
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Apr 9 21:39:27 2024 +0200
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methods
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 09 Apr 2024 21:45:04 +0200 |
parents | af48c532bd88 |
children | 8c9e43278b2c |
comparison
equal
deleted
inserted
replaced
34833:0fde4c80d761 | 34834:d3127b18fe1e |
---|---|
10581 assert_equal(16, IdClass2.Id(8)) | 10581 assert_equal(16, IdClass2.Id(8)) |
10582 END | 10582 END |
10583 v9.CheckScriptSuccess(lines) | 10583 v9.CheckScriptSuccess(lines) |
10584 enddef | 10584 enddef |
10585 | 10585 |
10586 " Test for defcompiling an abstract method | |
10587 def Test_abstract_method_defcompile() | |
10588 # Compile an abstract class with abstract object methods | |
10589 var lines =<< trim END | |
10590 vim9script | |
10591 abstract class A | |
10592 abstract def Foo(): string | |
10593 abstract def Bar(): list<string> | |
10594 endclass | |
10595 defcompile | |
10596 END | |
10597 v9.CheckScriptSuccess(lines) | |
10598 | |
10599 # Compile a concrete object method in an abstract class | |
10600 lines =<< trim END | |
10601 vim9script | |
10602 abstract class A | |
10603 abstract def Foo(): string | |
10604 abstract def Bar(): list<string> | |
10605 def Baz(): string | |
10606 pass | |
10607 enddef | |
10608 endclass | |
10609 defcompile | |
10610 END | |
10611 v9.CheckScriptFailure(lines, 'E476: Invalid command: pass', 1) | |
10612 | |
10613 # Compile a concrete class method in an abstract class | |
10614 lines =<< trim END | |
10615 vim9script | |
10616 abstract class A | |
10617 abstract def Foo(): string | |
10618 abstract def Bar(): list<string> | |
10619 static def Baz(): string | |
10620 pass | |
10621 enddef | |
10622 endclass | |
10623 defcompile | |
10624 END | |
10625 v9.CheckScriptFailure(lines, 'E476: Invalid command: pass', 1) | |
10626 enddef | |
10627 | |
10586 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 10628 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |