forked from aniani/vim
patch 8.2.3868: Vim9: function test fails
Problem: Vim9: function test fails. Solution: Add missing changes. Add test for earlier patch.
This commit is contained in:
@@ -2328,27 +2328,43 @@ def s:ElseifConstant()
|
|||||||
elseif false
|
elseif false
|
||||||
echo "false"
|
echo "false"
|
||||||
endif
|
endif
|
||||||
|
if 0
|
||||||
|
echo "yes"
|
||||||
|
elseif 0
|
||||||
|
echo "no"
|
||||||
|
endif
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_debug_elseif_constant()
|
def Test_debug_elseif_constant()
|
||||||
var res = execute('disass s:ElseifConstant')
|
var res = execute('disass debug s:ElseifConstant')
|
||||||
assert_match('<SNR>\d*_ElseifConstant\_s*' ..
|
assert_match('<SNR>\d*_ElseifConstant\_s*' ..
|
||||||
'if g:value\_s*' ..
|
'if g:value\_s*' ..
|
||||||
'0 LOADG g:value\_s*' ..
|
'0 DEBUG line 1-1 varcount 0\_s*' ..
|
||||||
'1 COND2BOOL\_s*' ..
|
'1 LOADG g:value\_s*' ..
|
||||||
'2 JUMP_IF_FALSE -> 6\_s*' ..
|
'2 COND2BOOL\_s*' ..
|
||||||
|
'3 JUMP_IF_FALSE -> 8\_s*' ..
|
||||||
'echo "one"\_s*' ..
|
'echo "one"\_s*' ..
|
||||||
'3 PUSHS "one"\_s*' ..
|
'4 DEBUG line 2-2 varcount 0\_s*' ..
|
||||||
'4 ECHO 1\_s*' ..
|
'5 PUSHS "one"\_s*' ..
|
||||||
|
'6 ECHO 1\_s*' ..
|
||||||
'elseif true\_s*' ..
|
'elseif true\_s*' ..
|
||||||
'5 JUMP -> 8\_s*' ..
|
'7 JUMP -> 12\_s*' ..
|
||||||
|
'8 DEBUG line 3-3 varcount 0\_s*' ..
|
||||||
'echo "true"\_s*' ..
|
'echo "true"\_s*' ..
|
||||||
'6 PUSHS "true"\_s*' ..
|
'9 DEBUG line 4-4 varcount 0\_s*' ..
|
||||||
'7 ECHO 1\_s*' ..
|
'10 PUSHS "true"\_s*' ..
|
||||||
|
'11 ECHO 1\_s*' ..
|
||||||
'elseif false\_s*' ..
|
'elseif false\_s*' ..
|
||||||
'echo "false"\_s*' ..
|
'echo "false"\_s*' ..
|
||||||
'endif\_s*' ..
|
'endif\_s*' ..
|
||||||
'\d RETURN void*',
|
'if 0\_s*' ..
|
||||||
|
'12 DEBUG line 8-8 varcount 0\_s*' ..
|
||||||
|
'echo "yes"\_s*' ..
|
||||||
|
'elseif 0\_s*' ..
|
||||||
|
'13 DEBUG line 11-10 varcount 0\_s*' ..
|
||||||
|
'echo "no"\_s*' ..
|
||||||
|
'endif\_s*' ..
|
||||||
|
'14 RETURN void*',
|
||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
@@ -749,6 +749,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 */
|
||||||
|
/**/
|
||||||
|
3868,
|
||||||
/**/
|
/**/
|
||||||
3867,
|
3867,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -567,7 +567,9 @@ check_type_maybe(
|
|||||||
{
|
{
|
||||||
// tt_type should match, except that a "partial" can be assigned to a
|
// tt_type should match, except that a "partial" can be assigned to a
|
||||||
// variable with type "func".
|
// variable with type "func".
|
||||||
|
// And "unknown" (using global variable) needs a runtime type check.
|
||||||
if (!(expected->tt_type == actual->tt_type
|
if (!(expected->tt_type == actual->tt_type
|
||||||
|
|| actual->tt_type == VAR_UNKNOWN
|
||||||
|| (expected->tt_type == VAR_FUNC
|
|| (expected->tt_type == VAR_FUNC
|
||||||
&& actual->tt_type == VAR_PARTIAL)))
|
&& actual->tt_type == VAR_PARTIAL)))
|
||||||
{
|
{
|
||||||
@@ -582,7 +584,7 @@ check_type_maybe(
|
|||||||
if (expected->tt_type == VAR_DICT || expected->tt_type == VAR_LIST)
|
if (expected->tt_type == VAR_DICT || expected->tt_type == VAR_LIST)
|
||||||
{
|
{
|
||||||
// "unknown" is used for an empty list or dict
|
// "unknown" is used for an empty list or dict
|
||||||
if (actual->tt_member != &t_unknown)
|
if (actual->tt_member != NULL && actual->tt_member != &t_unknown)
|
||||||
ret = check_type(expected->tt_member, actual->tt_member,
|
ret = check_type(expected->tt_member, actual->tt_member,
|
||||||
FALSE, where);
|
FALSE, where);
|
||||||
}
|
}
|
||||||
@@ -592,7 +594,8 @@ check_type_maybe(
|
|||||||
// nothing, thus there is no point in checking.
|
// nothing, thus there is no point in checking.
|
||||||
if (expected->tt_member != &t_unknown)
|
if (expected->tt_member != &t_unknown)
|
||||||
{
|
{
|
||||||
if (actual->tt_member != &t_unknown)
|
if (actual->tt_member != NULL
|
||||||
|
&& actual->tt_member != &t_unknown)
|
||||||
ret = check_type(expected->tt_member, actual->tt_member,
|
ret = check_type(expected->tt_member, actual->tt_member,
|
||||||
FALSE, where);
|
FALSE, where);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user