forked from aniani/vim
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:
@@ -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] = {}
|
||||
|
||||
Reference in New Issue
Block a user