mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Problem: Vim9: "const!" not sufficiently tested. Solution: Add a few more test cases. Fix type checking.
This commit is contained in:
@@ -831,6 +831,24 @@ def Test_const()
|
|||||||
list->assert_equal([4, 2, 3])
|
list->assert_equal([4, 2, 3])
|
||||||
const! other = [5, 6, 7]
|
const! other = [5, 6, 7]
|
||||||
other->assert_equal([5, 6, 7])
|
other->assert_equal([5, 6, 7])
|
||||||
|
|
||||||
|
let varlist = [7, 8]
|
||||||
|
const! constlist = [1, varlist, 3]
|
||||||
|
varlist[0] = 77
|
||||||
|
# TODO: does not work yet
|
||||||
|
# constlist[1][1] = 88
|
||||||
|
let cl = constlist[1]
|
||||||
|
cl[1] = 88
|
||||||
|
constlist->assert_equal([1, [77, 88], 3])
|
||||||
|
|
||||||
|
let vardict = #{five: 5, six: 6}
|
||||||
|
const! constdict = #{one: 1, two: vardict, three: 3}
|
||||||
|
vardict['five'] = 55
|
||||||
|
# TODO: does not work yet
|
||||||
|
# constdict['two']['six'] = 66
|
||||||
|
let cd = constdict['two']
|
||||||
|
cd['six'] = 66
|
||||||
|
constdict->assert_equal(#{one: 1, two: #{five: 55, six: 66}, three: 3})
|
||||||
END
|
END
|
||||||
CheckDefAndScriptSuccess(lines)
|
CheckDefAndScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
@@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
1686,
|
||||||
/**/
|
/**/
|
||||||
1685,
|
1685,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -5066,12 +5066,13 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
{
|
{
|
||||||
type_T *use_type = lvar->lv_type;
|
type_T *use_type = lvar->lv_type;
|
||||||
|
|
||||||
// without operator type is here, otherwise below
|
// without operator check type here, otherwise below
|
||||||
if (has_index)
|
if (has_index)
|
||||||
{
|
{
|
||||||
use_type = use_type->tt_member;
|
use_type = use_type->tt_member;
|
||||||
if (use_type == NULL)
|
if (use_type == NULL)
|
||||||
use_type = &t_void;
|
// could be indexing "any"
|
||||||
|
use_type = &t_any;
|
||||||
}
|
}
|
||||||
if (need_type(stacktype, use_type, -1, cctx, FALSE)
|
if (need_type(stacktype, use_type, -1, cctx, FALSE)
|
||||||
== FAIL)
|
== FAIL)
|
||||||
|
Reference in New Issue
Block a user