Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 21578:7417cb54cb24 v8.2.1339
patch 8.2.1339: Vim9: assigning to global dict variable doesn't work
Commit: https://github.com/vim/vim/commit/2caa1594e72be7a876c21ed5c2df252d3537cfa7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 15:53:19 2020 +0200
patch 8.2.1339: Vim9: assigning to global dict variable doesn't work
Problem: Vim9: assigning to global dict variable doesn't work.
Solution: Guess variable type based in index type. (issue https://github.com/vim/vim/issues/6591)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 16:00:04 +0200 |
parents | f4252efe370e |
children | d0c76ce48326 |
comparison
equal
deleted
inserted
replaced
21577:c17665b3de40 | 21578:7417cb54cb24 |
---|---|
272 return test | 272 return test |
273 enddef | 273 enddef |
274 FillDict() | 274 FillDict() |
275 END | 275 END |
276 call CheckScriptFailure(lines, 'E1103:') | 276 call CheckScriptFailure(lines, 'E1103:') |
277 | |
278 # assignment to global dict | |
279 lines =<< trim END | |
280 vim9script | |
281 g:test = {} | |
282 def FillDict(): dict<any> | |
283 g:test['a'] = 43 | |
284 return g:test | |
285 enddef | |
286 assert_equal(#{a: 43}, FillDict()) | |
287 END | |
288 call CheckScriptSuccess(lines) | |
289 | |
290 # assignment to buffer dict | |
291 lines =<< trim END | |
292 vim9script | |
293 b:test = {} | |
294 def FillDict(): dict<any> | |
295 b:test['a'] = 43 | |
296 return b:test | |
297 enddef | |
298 assert_equal(#{a: 43}, FillDict()) | |
299 END | |
300 call CheckScriptSuccess(lines) | |
277 enddef | 301 enddef |
278 | 302 |
279 def Test_assignment_local() | 303 def Test_assignment_local() |
280 # Test in a separated file in order not to the current buffer/window/tab is | 304 # Test in a separated file in order not to the current buffer/window/tab is |
281 # changed. | 305 # changed. |