-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Description
Given t1.vim:
let mydict = #{one: 0}Given t2.vim:
let mydict = {"one": 0}Printing node in parse_expr9 shows:
{'type': 83, 'pos': {'i': 13, 'lnum': 1, 'col': 14, 'offset': 13}, 'value': [[{'type': 81, 'pos': 15, 'value': "'one'"}, {'type': 80, 'pos': {'i': 20, 'lnum': 1, 'col': 21, 'offset': 20}, 'value': '0'}]]} {'i': 13, 'lnum': 1, 'col': 14, 'offset': 13}
vs
{'type': 83, 'pos': {'i': 13, 'lnum': 1, 'col': 14, 'offset': 13}, 'value': [[{'type': 81, 'pos': {'i': 14, 'lnum': 1, 'col': 15, 'offset': 14}, 'value': '"one"'}, {'type': 80, 'pos': {'i': 21, 'lnum': 1, 'col': 22, 'offset': 21}, 'value': '0'}]]} {'i': 13, 'lnum': 1, 'col': 14, 'offset': 13}
Note that "pos" for the key is a dict in the second case, but only a number in the first one.
Related code:
vim-vimlparser/autoload/vimlparser.vim
Lines 4213 to 4218 in 9cc29ee
| function! s:ExprParser.parse_dict_literal_key() abort | |
| let node = s:Node(s:NODE_STRING) | |
| let node.pos = self.reader.tell() | |
| let node.value = "'" . self.tokenizer.get_dict_literal_key() . "'" | |
| return node | |
| endfunction |
This causes an error in Vint then, which expects a dict there: Vimjas/vint#339.