summaryrefslogtreecommitdiffstats
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-05 22:14:54 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-05 22:14:54 +0200
commit8922860afb2cf9e89417c0c1417f1fb4458d3b44 (patch)
treeac4d2e2ae32f60ac80389414e50878b0fa35c080 /src/vim9compile.c
parent5ba8d3578c835edcfb7e3b132e623c12e62f250b (diff)
patch 8.2.0519: Vim9: return type not properly checkedv8.2.0519
Problem: Vim9: return type not properly checked. Solution: Check type properly, also at runtime.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 98936dd660..0dfe5a1634 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2432,7 +2432,7 @@ check_type(type_T *expected, type_T *actual, int give_msg)
if (ret == FAIL && give_msg)
type_mismatch(expected, actual);
}
- return OK;
+ return ret;
}
/*
@@ -2444,7 +2444,7 @@ check_type(type_T *expected, type_T *actual, int give_msg)
static int
need_type(type_T *actual, type_T *expected, int offset, cctx_T *cctx)
{
- if (check_type(expected, actual, FALSE))
+ if (check_type(expected, actual, FALSE) == OK)
return OK;
if (actual->tt_type != VAR_ANY && actual->tt_type != VAR_UNKNOWN)
{
@@ -4069,7 +4069,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
lvar->lv_type = stacktype;
}
}
- else if (check_type(lvar->lv_type, stacktype, TRUE) == FAIL)
+ else if (need_type(stacktype, lvar->lv_type, -1, cctx) == FAIL)
goto theend;
}
else if (*p != '=' && check_type(type, stacktype, TRUE) == FAIL)