mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3230: Vim9: type error when function return type is not known yet
Problem: Vim9: type error when function return type is not known yet. Solution: When return type is unknown, use "any". (closes #8644)
This commit is contained in:
parent
4490ec4e83
commit
f723701de0
@ -1172,6 +1172,16 @@ def Test_get()
|
|||||||
var F: func = function('min', [[5, 8, 6]])
|
var F: func = function('min', [[5, 8, 6]])
|
||||||
F->get('name')->assert_equal('min')
|
F->get('name')->assert_equal('min')
|
||||||
F->get('args')->assert_equal([[5, 8, 6]])
|
F->get('args')->assert_equal([[5, 8, 6]])
|
||||||
|
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def DoThat(): number
|
||||||
|
var Getqflist: func = function('getqflist', [{id: 42}])
|
||||||
|
return Getqflist()->get('id', 77)
|
||||||
|
enddef
|
||||||
|
assert_equal(0, DoThat())
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_getbufinfo()
|
def Test_getbufinfo()
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3230,
|
||||||
/**/
|
/**/
|
||||||
3229,
|
3229,
|
||||||
/**/
|
/**/
|
||||||
|
@ -2130,6 +2130,9 @@ generate_PCALL(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret_type = type->tt_member;
|
ret_type = type->tt_member;
|
||||||
|
if (ret_type == &t_unknown)
|
||||||
|
// return type not known yet, use a runtime check
|
||||||
|
ret_type = &t_any;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user