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/vim9compile.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/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index abe1e2fb50..136bea49d3 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1737,11 +1737,14 @@ compile_lhs( if (is_decl) { // if we come here with what looks like an assignment like - // .= but which has been reject by assignment_len() from + // .= but which has been rejected by assignment_len() from // may_compile_assignment give a better error message char_u *p = skipwhite(lhs->lhs_end); if (p[0] == '.' && p[1] == '=') emsg(_(e_dot_equal_not_supported_with_script_version_two)); + else if (p[0] == ':') + // type specified in a non-var assignment + semsg(_(e_trailing_characters_str), p); else semsg(_(e_variable_already_declared_str), lhs->lhs_name); return FAIL; |