patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Problem: Vim9: not enough type checking in Vim9 script.
Solution: Use same type checking as in a :def function.
diff --git a/src/eval.c b/src/eval.c
index 6a1bc4c..595cd06 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2460,8 +2460,16 @@
}
if (evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE))
{
- int ret = typval_compare(rettv, &var2, type, ic);
+ int ret;
+ if (in_vim9script() && check_compare_types(
+ type, rettv, &var2) == FAIL)
+ {
+ ret = FAIL;
+ clear_tv(rettv);
+ }
+ else
+ ret = typval_compare(rettv, &var2, type, ic);
clear_tv(&var2);
return ret;
}