0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1986: Vim9: accepting type-annotations

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>
This commit is contained in:
Yegappan Lakshmanan
2023-10-05 20:14:43 +02:00
committed by Christian Brabandt
parent b6d01f131c
commit b5a0719cb7
6 changed files with 55 additions and 1 deletions

View File

@@ -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,