Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 24363:1a145eb83a28 v8.2.2722
patch 8.2.2722: Vim9: crash when using LHS with double index
Commit: https://github.com/vim/vim/commit/b9c0cd897ab4ad54f514187e89719c0241393f8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 5 20:51:00 2021 +0200
patch 8.2.2722: Vim9: crash when using LHS with double index
Problem: Vim9: crash when using LHS with double index.
Solution: Handle lhs_dest which is "dest_expr". (closes https://github.com/vim/vim/issues/8068)
Fix confusing error message for missing dict item.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Apr 2021 21:00:04 +0200 |
parents | 108a6e2497f6 |
children | 95b8937804d3 |
comparison
equal
deleted
inserted
replaced
24362:63a46a4e0d55 | 24363:1a145eb83a28 |
---|---|
1144 | 1144 |
1145 dn['a'] %= 3 | 1145 dn['a'] %= 3 |
1146 assert_equal(2, dn.a) | 1146 assert_equal(2, dn.a) |
1147 dn.a %= 6 | 1147 dn.a %= 6 |
1148 assert_equal(2, dn.a) | 1148 assert_equal(2, dn.a) |
1149 | |
1150 var dd: dict<dict<list<any>>> | |
1151 dd.a = {} | |
1152 dd.a.b = [0] | |
1153 dd.a.b += [1] | |
1154 assert_equal({a: {b: [0, 1]}}, dd) | |
1149 END | 1155 END |
1150 CheckDefAndScriptSuccess(lines) | 1156 CheckDefAndScriptSuccess(lines) |
1151 enddef | 1157 enddef |
1152 | 1158 |
1153 def Test_assign_list_with_op() | 1159 def Test_assign_list_with_op() |
1185 lines =<< trim END | 1191 lines =<< trim END |
1186 var s = 'abc' | 1192 var s = 'abc' |
1187 s[1] ..= 'x' | 1193 s[1] ..= 'x' |
1188 END | 1194 END |
1189 CheckDefAndScriptFailure2(lines, 'E1141:', 'E689:', 2) | 1195 CheckDefAndScriptFailure2(lines, 'E1141:', 'E689:', 2) |
1196 | |
1197 lines =<< trim END | |
1198 var dd: dict<dict<list<any>>> | |
1199 dd.a = {} | |
1200 dd.a.b += [1] | |
1201 END | |
1202 CheckDefExecAndScriptFailure(lines, 'E716:', 3) | |
1190 enddef | 1203 enddef |
1191 | 1204 |
1192 def Test_assign_lambda() | 1205 def Test_assign_lambda() |
1193 # check if assign a lambda to a variable which type is func or any. | 1206 # check if assign a lambda to a variable which type is func or any. |
1194 var lines =<< trim END | 1207 var lines =<< trim END |