diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-10-05 20:14:43 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-10-05 20:16:06 +0200 |
commit | b5a0719cb7abf51b0540df527cb9738a3ccf0d37 (patch) | |
tree | 5fa50a382935836aaede388f18fa751231d67d8d /src/eval.c | |
parent | b6d01f131c6ad44451b63ff437fa04169173f1c5 (diff) |
patch 9.0.1986: Vim9: accepting type-annotationsv9.0.1986
Problem: Vim9: accepting type-annotations
Solution: Reject type annotations outside of declarations.
closes: #13267
closes: #13283
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 0a335df071..19ab01561d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1271,6 +1271,14 @@ get_lval( semsg(_(e_using_type_not_in_script_context_str), p); return NULL; } + if (vim9script && (flags & GLV_NO_DECL) && + !(flags & GLV_FOR_LOOP)) + { + // Using a type and not in a "var" declaration. + semsg(_(e_trailing_characters_str), p); + return NULL; + } + // parse the type after the name lp->ll_type = parse_type(&tp, |