summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-22 21:45:14 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-22 21:45:14 +0200
commit4cdb13ce81309b62b636f2c614241959174d3fef (patch)
tree1aca6deba270ad18affef8d6be22a2b8ffd13fe4 /src/eval.c
parent0f60e80f9b6d778e460b4dc8333cd8e17c1b620b (diff)
patch 8.2.1272: Vim9: type not checked if declaration also assigns valuev8.2.1272
Problem: Vim9: type not checked if declaration also assigns value. Solution: Check the type. (issue #6507)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index c3f0ee5c9f..a8e388db01 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1270,7 +1270,12 @@ set_var_lval(
}
}
else
+ {
+ if (lp->ll_type != NULL
+ && check_typval_type(lp->ll_type, rettv) == FAIL)
+ return;
set_var_const(lp->ll_name, lp->ll_type, rettv, copy, flags);
+ }
*endp = cc;
}
else if (var_check_lock(lp->ll_newkey == NULL