Mercurial > vim
comparison src/vim9compile.c @ 23531:f39a18a42aed v8.2.2308
patch 8.2.2308: Vim9: no error when assigning lambda to funcref
Commit: https://github.com/vim/vim/commit/328eac2b5d1569c57e1130ecb9f7cca733b84d78
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 7 19:23:08 2021 +0100
patch 8.2.2308: Vim9: no error when assigning lambda to funcref
Problem: Vim9: no error when assigning lambda to funcref without return
value.
Solution: Default return value to "any". (closes #7629)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 07 Jan 2021 19:30:06 +0100 |
parents | 27ca5534a408 |
children | 7f0fc2ab90e3 |
comparison
equal
deleted
inserted
replaced
23530:47d509a28915 | 23531:f39a18a42aed |
---|---|
855 if (actual->tt_type == VAR_ANY | 855 if (actual->tt_type == VAR_ANY |
856 || actual->tt_type == VAR_UNKNOWN | 856 || actual->tt_type == VAR_UNKNOWN |
857 || (actual->tt_type == VAR_FUNC | 857 || (actual->tt_type == VAR_FUNC |
858 && (expected->tt_type == VAR_FUNC | 858 && (expected->tt_type == VAR_FUNC |
859 || expected->tt_type == VAR_PARTIAL) | 859 || expected->tt_type == VAR_PARTIAL) |
860 && (actual->tt_member == &t_any || actual->tt_argcount < 0))) | 860 && (actual->tt_member == &t_any || actual->tt_argcount < 0) |
861 && ((actual->tt_member == &t_void) | |
862 == (expected->tt_member == &t_void)))) | |
861 return TRUE; | 863 return TRUE; |
862 if ((actual->tt_type == VAR_LIST || actual->tt_type == VAR_DICT) | 864 if ((actual->tt_type == VAR_LIST || actual->tt_type == VAR_DICT) |
863 && actual->tt_type == expected->tt_type) | 865 && actual->tt_type == expected->tt_type) |
864 // This takes care of a nested list or dict. | 866 // This takes care of a nested list or dict. |
865 return use_typecheck(actual->tt_member, expected->tt_member); | 867 return use_typecheck(actual->tt_member, expected->tt_member); |
4810 | 4812 |
4811 if (cctx->ctx_skip != SKIP_YES) | 4813 if (cctx->ctx_skip != SKIP_YES) |
4812 { | 4814 { |
4813 stack_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; | 4815 stack_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
4814 if (check_return_type && (cctx->ctx_ufunc->uf_ret_type == NULL | 4816 if (check_return_type && (cctx->ctx_ufunc->uf_ret_type == NULL |
4815 || cctx->ctx_ufunc->uf_ret_type == &t_unknown)) | 4817 || cctx->ctx_ufunc->uf_ret_type == &t_unknown |
4818 || cctx->ctx_ufunc->uf_ret_type == &t_any)) | |
4816 { | 4819 { |
4817 cctx->ctx_ufunc->uf_ret_type = stack_type; | 4820 cctx->ctx_ufunc->uf_ret_type = stack_type; |
4818 } | 4821 } |
4819 else | 4822 else |
4820 { | 4823 { |