Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 23187:013aa8e2be8c v8.2.2139
patch 8.2.2139: Vim9: unreachable code in assignment
Commit: https://github.com/vim/vim/commit/acbae18df528b6aee72ecfd66e344dc8be7b3775
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 13 18:44:43 2020 +0100
patch 8.2.2139: Vim9: unreachable code in assignment
Problem: Vim9: unreachable code in assignment.
Solution: Don't check "new_local" when "has_index" is set. Add test for
wrong type of list index.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Dec 2020 18:45:16 +0100 |
parents | 055fa9db6f39 |
children | 98548b8fbc98 |
comparison
equal
deleted
inserted
replaced
23186:00583b0bedd5 | 23187:013aa8e2be8c |
---|---|
323 var d3: dict<dict<number>> | 323 var d3: dict<dict<number>> |
324 d3.one = {} | 324 d3.one = {} |
325 d3.one.two = {} | 325 d3.one.two = {} |
326 END | 326 END |
327 CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3) | 327 CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3) |
328 | |
329 lines =<< trim END | |
330 var lines: list<string> | |
331 lines['a'] = 'asdf' | |
332 END | |
333 CheckDefFailure(lines, 'E39:', 2) | |
334 | |
335 lines =<< trim END | |
336 var lines: string | |
337 lines[9] = 'asdf' | |
338 END | |
339 CheckDefFailure(lines, 'E1141:', 2) | |
328 | 340 |
329 # list of dict | 341 # list of dict |
330 var ld: list<dict<number>> | 342 var ld: list<dict<number>> |
331 ld[0] = {} | 343 ld[0] = {} |
332 ld[0].one = 123 | 344 ld[0].one = 123 |