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.c
→ g: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.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.