forked from aniani/vim
patch 9.1.0674: Vim9: compiling abstract method fails because of missing return
Problem: Vim9: compiling abstract method fails because of missing
return (Aliaksei Budavei)
Solution: don't require a return statement for an abstract method when
compiling (Ernie Rael)
fixes: #15432
closes: #15441
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
ea76096fa9
commit
7477861e0d
@@ -6264,6 +6264,27 @@ def Test_abstract_method()
|
||||
assert_equal('foo', A.Foo())
|
||||
END
|
||||
v9.CheckSourceSuccess(lines)
|
||||
|
||||
# Invoke method returning a value through the abstract class. See #15432.
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
|
||||
abstract class A
|
||||
abstract def String(): string
|
||||
endclass
|
||||
|
||||
class B extends A
|
||||
def String(): string
|
||||
return 'B'
|
||||
enddef
|
||||
endclass
|
||||
|
||||
def F(o: A)
|
||||
assert_equal('B', o.String())
|
||||
enddef
|
||||
F(B.new())
|
||||
END
|
||||
v9.CheckSourceSuccess(lines)
|
||||
enddef
|
||||
|
||||
" Test for calling a class method from a subclass
|
||||
|
||||
Reference in New Issue
Block a user