Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with #{key: value} (TypeError: 'int' object is not subscriptable) #339

Closed
zhmars opened this issue Dec 23, 2019 · 4 comments
Closed

Comments

@zhmars
Copy link

zhmars commented Dec 23, 2019

Hi, I got some error with this minimal.vim.

let mydict = #{zero: 0, one_key: 1, two-key: 2, 333: 3}

Environment

vint --version : 0.3.21.dev45+gbcd6562

Reproduce

  • vint minimal.vim
Traceback (most recent call last):
  File "/home/mars/.local/python/bin/vint", line 11, in <module>
    load_entry_point('vim-vint==0.3.21.dev45+gbcd6562', 'console_scripts', 'vint')()
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/__init__.py", line 11, in main
    init_cli()
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/bootstrap.py", line 21, in init_cli
    start_cli()
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/cli.py", line 38, in start_cli
    violations = _lint_all(env, config_dict)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/cli.py", line 131, in _lint_all
    violations += linter.lint(lint_target)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/linter.py", line 106, in lint
    self._traverse(root_ast, lint_target)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/linter.py", line 132, in _traverse
    traverse(root_ast,
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in traverse
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 9, in for_each
    call_if_def(func, node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 23, in call_if_def
    func(node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in <lambda>
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in traverse
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 23, in call_if_def
    func(node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in <lambda>
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in traverse
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 15, in for_each_deeply
    for_each(func, nodes)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 9, in for_each
    call_if_def(func, node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 23, in call_if_def
    func(node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 247, in <lambda>
    accessor_func(lambda child_node: traverse(child_node, on_enter, on_leave),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/ast/traversing.py", line 238, in traverse
    should_traverse_children = on_enter(node) is not SKIP_CHILDREN
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/linter.py", line 133, in <lambda>
    on_enter=lambda node: self._handle_enter(node, lint_context),
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/linter.py", line 151, in _handle_enter
    self._refresh_policies_if_necessary(node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/linter.py", line 185, in _refresh_policies_if_necessary
    dynamic_config.update_by_node(node)
  File "/home/mars/.local/python/lib/python3.8/site-packages/vint/linting/config/config_next_line_comment_source.py", line 43, in update_by_node
    lnum_of_node = node['pos']['lnum']
TypeError: 'int' object is not subscriptable
@blueyed blueyed changed the title TypeError: 'int' object is not subscriptable Crash with #{key: value} (TypeError: 'int' object is not subscriptable) Dec 23, 2019
@blueyed
Copy link
Member

blueyed commented Dec 23, 2019

Same/similar on master.
This dict syntax is not supported yet, but vimlparser appears to support it already:

(let = mydict (dict ('zero' 0) ('one_key' 1) ('two-key' 2) ('333' 3)))

@blueyed
Copy link
Member

blueyed commented Dec 23, 2019

It appears to be a bug in vimlparser after all: vim-jp/vim-vimlparser#155

@tyru
Copy link
Collaborator

tyru commented Mar 6, 2020

This seems already fixed.

@zhmars
Copy link
Author

zhmars commented May 6, 2020

This seems already fixed.

Confirmed. Thanks.

@zhmars zhmars closed this as completed May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants