summaryrefslogtreecommitdiffstats
path: root/src/vim9type.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-15 16:22:38 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-15 16:22:38 +0100
commit2ba51236fb7c27fe16dad4c44242f00e17c19726 (patch)
treec394d7f9f7ca93244bbb169a4c42c6e1870f385e /src/vim9type.c
parenta2c0028fdf8dcf0408e27be730ac0e691ef9559b (diff)
patch 9.0.1559: function argument types not always checkedv9.0.1559
Problem: Function argument types not always checked and using v:none may cause an error. Solution: Check argument types once the function type is known. Do not give an error for using v:none as an argument. (closes #12200)
Diffstat (limited to 'src/vim9type.c')
-rw-r--r--src/vim9type.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vim9type.c b/src/vim9type.c
index 95252dbafe..0dd74ee184 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -970,7 +970,10 @@ check_argument_types(
}
else
expected = type->tt_args[i];
- if (check_typval_arg_type(expected, tv, NULL, i + 1) == FAIL)
+
+ // check the type, unless the value is v:none
+ if ((tv->v_type != VAR_SPECIAL || tv->vval.v_number != VVAL_NONE)
+ && check_typval_arg_type(expected, tv, NULL, i + 1) == FAIL)
return FAIL;
}
return OK;