diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-10-09 18:01:06 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-10-09 18:01:06 +0200 |
commit | e4671890220ef3f2bca43fde6ffe5d3ef3ed0e42 (patch) | |
tree | 603f12ed52e0efdbc360b9106201c142d8b118b8 /src/vim9type.c | |
parent | f4ee1cb74ba86383190ffcda84147892f7740f21 (diff) |
patch 9.0.2007: Vim9: covariant parameter types allowedv9.0.2007
Problem: Vim9: covariant parameter types allowed when assigning
functions
Solution: Enforce invariant type check for arguments and return value
when assigning a funcref
closes: #13299
closes: #13305
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/vim9type.c')
-rw-r--r-- | src/vim9type.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vim9type.c b/src/vim9type.c index de1033c2e9..338aee14a7 100644 --- a/src/vim9type.c +++ b/src/vim9type.c @@ -874,8 +874,7 @@ check_type_maybe( { where_T func_where = where; - if (where.wt_kind == WT_METHOD) - func_where.wt_kind = WT_METHOD_RETURN; + func_where.wt_kind = WT_METHOD_RETURN; ret = check_type_maybe(expected->tt_member, actual->tt_member, FALSE, func_where); @@ -898,8 +897,7 @@ check_type_maybe( && i < actual->tt_argcount; ++i) { where_T func_where = where; - if (where.wt_kind == WT_METHOD) - func_where.wt_kind = WT_METHOD_ARG; + func_where.wt_kind = WT_METHOD_ARG; // Allow for using "any" argument type, lambda's have them. if (actual->tt_args[i] != &t_any && check_type( |