patch 9.1.1586: Vim9: can define an enum/interface in a function

Problem:  Vim9: can define an enum/interface in a function
          (lacygoill)
Solution: Give an error when defining an enum or an interface inside a
          function (Yegappan Lakshmanan)

fixes: #17835
fixes: #17837
closes: #17837

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-07-24 19:14:51 +02:00
committed by Christian Brabandt
parent 4de931daae
commit 9239eadc71
8 changed files with 57 additions and 4 deletions

View File

@ -4618,6 +4618,8 @@ E143 autocmd.txt /*E143*
E1432 vim9.txt /*E1432*
E1433 vim9.txt /*E1433*
E1434 vim9.txt /*E1434*
E1435 vim9class.txt /*E1435*
E1436 vim9class.txt /*E1436*
E144 various.txt /*E144*
E145 starting.txt /*E145*
E146 change.txt /*E146*

View File

@ -1,4 +1,4 @@
*vim9class.txt* For Vim version 9.1. Last change: 2025 Apr 21
*vim9class.txt* For Vim version 9.1. Last change: 2025 Jul 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -584,6 +584,8 @@ protected 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.
An interface cannot be defined inside a function. *E1436*
==============================================================================
6. More class details *Vim9-class* *Class* *class*
@ -971,7 +973,7 @@ of that class. Unlike typical object instantiation with the |new()| method,
enum instances cannot be created this way.
An enum can only be defined in a |Vim9| script file. *E1414*
An enum cannot be defined inside a function.
An enum cannot be defined inside a function. *E1435*
*E1415*
An enum name must start with an uppercase letter. The name of an enum value