patch 9.0.1178: a child class cannot override functions from a base class
Problem: A child class cannot override functions from a base class.
Solution: Allow overriding and implement "super".
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index c7ee218..220cb75 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -817,6 +817,27 @@
endclass
END
v9.CheckScriptFailure(lines, 'E1354: Cannot extend SomeVar')
+
+ lines =<< trim END
+ vim9script
+ class Base
+ this.name: string
+ def ToString(): string
+ return this.name
+ enddef
+ endclass
+
+ class Child extends Base
+ this.age: number
+ def ToString(): string
+ return super.ToString() .. ': ' .. this.age
+ enddef
+ endclass
+
+ var o = Child.new('John', 42)
+ assert_equal('John: 42', o.ToString())
+ END
+ v9.CheckScriptSuccess(lines)
enddef