Skip to content

Commit 7257af4

Browse files
committed
patch 8.2.2115: Vim9: some errors not tested for; dead code
Problem: Vim9: some errors not tested for; dead code. Solution: Add a test. Remove dead code.
1 parent 61265b4 commit 7257af4

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/testdir/test_vim9_assign.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,9 @@ def Test_var_declaration()
10451045
s:name = 'prefixed'
10461046
g:var_prefixed = s:name
10471047

1048+
const FOO: number = 123
1049+
assert_equal(123, FOO)
1050+
10481051
var s:other: number
10491052
other = 1234
10501053
g:other_var = other
@@ -1087,6 +1090,10 @@ def Test_var_declaration_fails()
10871090
var 9var: string
10881091
END
10891092
CheckScriptFailure(lines, 'E475:')
1093+
1094+
CheckDefFailure(['var foo.bar = 2'], 'E1087:')
1095+
CheckDefFailure(['var foo[3] = 2'], 'E1087:')
1096+
CheckDefFailure(['const foo: number'], 'E1021:')
10901097
enddef
10911098

10921099
def Test_var_type_check()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2115,
753755
/**/
754756
2114,
755757
/**/

src/vim9compile.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5705,12 +5705,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
57055705

57065706
// without operator check type here, otherwise below
57075707
if (has_index)
5708-
{
57095708
use_type = member_type;
5710-
if (member_type == NULL)
5711-
// could be indexing "any"
5712-
use_type = &t_any;
5713-
}
57145709
if (need_type(rhs_type, use_type, -1, cctx,
57155710
FALSE, is_const) == FAIL)
57165711
goto theend;

0 commit comments

Comments
 (0)