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/tags b/runtime/doc/tags
index daf59a9..918e767 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4479,6 +4479,9 @@
E1381 vim9class.txt /*E1381*
E1382 vim9class.txt /*E1382*
E1383 vim9class.txt /*E1383*
+E1387 vim9class.txt /*E1387*
+E1388 vim9class.txt /*E1388*
+E1389 vim9class.txt /*E1389*
E139 message.txt /*E139*
E140 message.txt /*E140*
E1400 builtin.txt /*E1400*
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