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

Vim9: crash when flattening list of lists #8862

Closed
lacygoill opened this issue Sep 11, 2021 · 0 comments
Closed

Vim9: crash when flattening list of lists #8862

lacygoill opened this issue Sep 11, 2021 · 0 comments

Comments

@lacygoill
Copy link

Describe the bug

In Vim9 script, flattening a list of lists might make Vim crash.

To Reproduce

Run this shell command:

vim -Nu NONE -S <(cat <<'EOF'
    vim9script
    def Func()
        var ll: list<list<string>> = [['a', 'b', 'c']]
        ll->flattennew()->join()->setline(1)
    enddef
    Func()
EOF
)

Vim crashes.

Expected behavior

Vim doesn't crash. a b c is written on the first line of the buffer.

Environment

  • Vim version: 8.2 Included patches: 1-3424
  • OS: Ubuntu 20.04.3 LTS
  • Terminal: XTerm(353)

Additional context

Regression introduced in patch 8.2.3422.


No crash if we don't declare the type of ll, and rely on type inferrence:

vim9script
def Func()
    var ll = [['a', 'b', 'c']]
    ll->flattennew()->join()->setline(1)
enddef
Func()

No crash at the script level; but there is still an unexpected type mismatch error:

vim9script
var ll: list<list<string>> = [['a', 'b', 'c']]
ll->flattennew()->join()->setline(1)
E1012: Type mismatch; expected list<string> but got string

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

1 participant