patch 9.0.1945: Vim9: missing support for ro-vars in interface
Problem: Vim9: missing support for ro-vars in interface
Solution: Support only read-only object variables in an interface,
add additional checks when parsing class definitions.
closes: #13183
cloess: #13184
cloess: #13185.
closes: #13188
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt
index a27f731..b230cb8 100644
--- a/runtime/doc/vim9class.txt
+++ b/runtime/doc/vim9class.txt
@@ -464,10 +464,10 @@
echo $'the surface is {shape.Surface()}'
endfor
<
- *E1378* *E1379* *E1380*
-An interface can have only instance variables (read-only and read-write
-access) and methods. An interface cannot contain private variables, private
-methods, class variables and class methods.
+ *E1378* *E1379* *E1380* *E1387*
+An interface can contain only object methods and read-only object variables.
+An interface cannot contain read-write and private object variables, private
+object methods, class variables and class methods.
An interface can extend another interface using "extends". The sub-interface
inherits all the instance variables and methods from the super interface.
@@ -563,7 +563,7 @@
A class implementing an interface ~
- *implements* *E1346* *E1347*
+ *implements* *E1346* *E1347* *E1389*
A class can implement one or more interfaces. The "implements" keyword can
only appear once *E1350* . Multiple interfaces can be specified, separated by
commas. Each interface name can appear only once. *E1351*
@@ -577,7 +577,7 @@
Items in a class ~
- *E1318* *E1325*
+ *E1318* *E1325* *E1388*
Inside a class, in between `:class` and `:endclass`, these items can appear:
- An object variable declaration: >
this._privateVariableName: memberType