0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2020-12-13 18:44:43 +01:00
parent b5b9480ee9
commit acbae18df5
3 changed files with 14 additions and 4 deletions

View File

@@ -326,6 +326,18 @@ def Test_assign_index()
END
CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3)
lines =<< trim END
var lines: list<string>
lines['a'] = 'asdf'
END
CheckDefFailure(lines, 'E39:', 2)
lines =<< trim END
var lines: string
lines[9] = 'asdf'
END
CheckDefFailure(lines, 'E1141:', 2)
# list of dict
var ld: list<dict<number>>
ld[0] = {}