@@ -1597,13 +1597,31 @@ def Test_assignment_failure()
15971597 v9.CheckDefFailure ([' var name: dict<number' ], ' E1009:' )
15981598
15991599 v9.CheckDefFailure ([' w:foo: number = 10' ],
1600- ' E488: Trailing characters: : number = 1 ' )
1600+ ' E1016: Cannot declare a window variable: w:foo ' )
16011601 v9.CheckDefFailure ([' t:foo: bool = true' ],
1602- ' E488: Trailing characters: : bool = true ' )
1602+ ' E1016: Cannot declare a tab variable: t:foo ' )
16031603 v9.CheckDefFailure ([' b:foo: string = "x"' ],
1604- ' E488: Trailing characters: : string = "x" ' )
1604+ ' E1016: Cannot declare a buffer variable: b:foo ' )
16051605 v9.CheckDefFailure ([' g:foo: number = 123' ],
1606- ' E488: Trailing characters: : number = 123' )
1606+ ' E1016: Cannot declare a global variable: g:foo' )
1607+
1608+ v9.CheckScriptFailure ([' vim9script' , ' w:foo: number = 123' ],
1609+ ' E1304: Cannot use type with this variable: w:foo:' )
1610+ v9.CheckScriptFailure ([' vim9script' , ' t:foo: number = 123' ],
1611+ ' E1304: Cannot use type with this variable: t:foo:' )
1612+ v9.CheckScriptFailure ([' vim9script' , ' b:foo: number = 123' ],
1613+ ' E1304: Cannot use type with this variable: b:foo:' )
1614+ v9.CheckScriptFailure ([' vim9script' , ' g:foo: number = 123' ],
1615+ ' E1304: Cannot use type with this variable: g:foo:' )
1616+
1617+ v9.CheckScriptFailure ([' vim9script' , ' const w:FOO: number = 123' ],
1618+ ' E1304: Cannot use type with this variable: w:FOO:' )
1619+ v9.CheckScriptFailure ([' vim9script' , ' const t:FOO: number = 123' ],
1620+ ' E1304: Cannot use type with this variable: t:FOO:' )
1621+ v9.CheckScriptFailure ([' vim9script' , ' const b:FOO: number = 123' ],
1622+ ' E1304: Cannot use type with this variable: b:FOO:' )
1623+ v9.CheckScriptFailure ([' vim9script' , ' const g:FOO: number = 123' ],
1624+ ' E1304: Cannot use type with this variable: g:FOO:' )
16071625enddef
16081626
16091627def Test_assign_list ()
@@ -1959,8 +1977,6 @@ def Test_var_declaration()
19591977 FLIST[0 ] = 11
19601978 assert_equal ([11 ], FLIST)
19611979
1962- const g: FOO : number = 321
1963- assert_equal (321 , g: FOO )
19641980 const g: FOOS = ' gfoos'
19651981 assert_equal (' gfoos' , g: FOOS )
19661982 final g: FLIST = [2 ]
@@ -1975,8 +1991,6 @@ def Test_var_declaration()
19751991 assert_equal (123 , g: globConst )
19761992 assert_true (islocked (' g:globConst' ))
19771993
1978- const w: FOO : number = 46
1979- assert_equal (46 , w: FOO )
19801994 const w: FOOS = ' wfoos'
19811995 assert_equal (' wfoos' , w: FOOS )
19821996 final w: FLIST = [3 ]
@@ -2015,10 +2029,8 @@ def Test_var_declaration()
20152029 unlet g: var_prefixed
20162030 unlet g: other_var
20172031 unlet g: globConst
2018- unlet g: FOO
20192032 unlet g: FOOS
20202033 unlet g: FLIST
2021- unlet w: FOO
20222034 unlet w: FOOS
20232035 unlet w: FLIST
20242036enddef
0 commit comments