[vim/vim] Vim9: cannot compile function with test whose operand is dictionary member after false (Issue #10433)

17 views
Skip to first unread message

lacygoill

unread,
May 16, 2022, 2:03:30 PM5/16/22
to vim/vim, Subscribed

Steps to reproduce

Run this shell command:

vim -Nu NONE -S <(tee <<'EOF'

    vim9script

    def Func()

        if false && g:a == g:b.c

        endif

    enddef

    defcompile

EOF

)

An error is given:

E1028: Compiling :def function failed

Expected behavior

No error is given, because the code is syntactically correct; which is confirmed by the fact that no error is given at the script level:

vim9script

if false && g:a == g:b.c

endif
no error

Version of Vim

8.2 Included patches: 1-4960

Environment

Operating system: Ubuntu 20.04.4 LTS
Terminal: xterm
Value of $TERM: xterm-256color
Shell: GNU bash, version 5.0.17

Additional context

The previous example might seem contrived, because – in practice – we would rarely (if ever) write if false. Here is a slightly less contrived example:

vim9script

g:a = 0

g:b = {c: 0}

def Func()

    if !has('sound') && g:a == g:b.c

    endif

enddef

defcompile

This code fails when Vim has not been compiled with the +sound feature.


No issue if the dictionary member operand is replaced with a simple variable (g:b.cg:b):

vim9script

def Func()

    if false && g:a == g:b

    endif

enddef

defcompile
no error


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10433@github.com>

Bram Moolenaar

unread,
May 17, 2022, 10:04:24 AM5/17/22
to vim/vim, Subscribed

Closed #10433 via 1ff9c44.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10433/issue_event/6624814365@github.com>

Reply all
Reply to author
Forward
0 new messages