@@ -1334,7 +1334,17 @@ def Test_expr7_list()
13341334 # list
13351335 assert_equal (g: list_empty , [])
13361336 assert_equal (g: list_empty , [ ])
1337- assert_equal (g: list_mixed , [1 , ' b' , false,])
1337+
1338+ let numbers: list <number> = [1 , 2 , 3 ]
1339+ numbers = [1 ]
1340+ numbers = []
1341+
1342+ let strings: list <string> = [' a' , ' b' , ' c' ]
1343+ strings = [' x' ]
1344+ strings = []
1345+
1346+ let mixed: list <any> = [1 , ' b' , false,]
1347+ assert_equal (g: list_mixed , mixed)
13381348 assert_equal (' b' , g: list_mixed [1 ])
13391349
13401350 echo [1 ,
@@ -1348,6 +1358,10 @@ def Test_expr7_list()
13481358 call CheckDefFailure ([" let x = g:list_mixed[" ], ' E1097:' )
13491359 call CheckDefFailure ([" let x = g:list_mixed[0" ], ' E1097:' )
13501360 call CheckDefExecFailure ([" let x = g:list_empty[3]" ], ' E684:' )
1361+ call CheckDefFailure ([" let l: list<number> = [234, 'x']" ], ' E1013:' )
1362+ call CheckDefFailure ([" let l: list<number> = ['x', 234]" ], ' E1013:' )
1363+ call CheckDefFailure ([" let l: list<string> = [234, 'x']" ], ' E1013:' )
1364+ call CheckDefFailure ([" let l: list<string> = ['x', 123]" ], ' E1013:' )
13511365enddef
13521366
13531367def Test_expr7_list_vim9script ()
@@ -1437,6 +1451,19 @@ def Test_expr7_dict()
14371451 let val = 1
14381452 assert_equal (g: dict_one , {key : val})
14391453
1454+ let numbers: dict <number> = #{a: 1 , b: 2 , c : 3 }
1455+ numbers = #{a: 1 }
1456+ numbers = #{}
1457+
1458+ let strings: dict <string> = #{a: ' a' , b: ' b' , c : ' c' }
1459+ strings = #{a: ' x' }
1460+ strings = #{}
1461+
1462+ let mixed: dict <any> = #{a: ' a' , b: 42 }
1463+ mixed = #{a: ' x' }
1464+ mixed = #{a: 234 }
1465+ mixed = #{}
1466+
14401467 call CheckDefFailure ([" let x = #{8: 8}" ], ' E1014:' )
14411468 call CheckDefFailure ([" let x = #{xxx}" ], ' E720:' )
14421469 call CheckDefFailure ([" let x = #{xxx: 1" , " let y = 2" ], ' E722:' )
@@ -1449,6 +1476,11 @@ def Test_expr7_dict()
14491476 call CheckDefFailure ([" let x = x + 1" ], ' E1001:' )
14501477 call CheckDefExecFailure ([" let x = g:anint.member" ], ' E715:' )
14511478 call CheckDefExecFailure ([" let x = g:dict_empty.member" ], ' E716:' )
1479+
1480+ call CheckDefFailure ([' let x: dict<number> = #{a: 234, b: "1"}' ], ' E1013:' )
1481+ call CheckDefFailure ([' let x: dict<number> = #{a: "x", b: 134}' ], ' E1013:' )
1482+ call CheckDefFailure ([' let x: dict<string> = #{a: 234, b: "1"}' ], ' E1013:' )
1483+ call CheckDefFailure ([' let x: dict<string> = #{a: "x", b: 134}' ], ' E1013:' )
14521484enddef
14531485
14541486def Test_expr7_dict_vim9script ()
0 commit comments