mirror of
https://github.com/vim/vim.git
synced 2025-10-07 05:54:16 -04:00
patch 8.2.2846: Vim9: "echo Func()" does not give an error for using void
Problem: Vim9: "echo Func()" does not give an error for a function without a return value. Solution: Give an error. Be more specific about why a value is invalid.
This commit is contained in:
@@ -1282,5 +1282,28 @@ def Test_redir_to_var()
|
||||
CheckDefFailure(lines, 'E1141:')
|
||||
enddef
|
||||
|
||||
def Test_echo_void()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def NoReturn()
|
||||
echo 'nothing'
|
||||
enddef
|
||||
echo NoReturn()
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1186:', 5)
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
def NoReturn()
|
||||
echo 'nothing'
|
||||
enddef
|
||||
def Try()
|
||||
echo NoReturn()
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1186:', 1)
|
||||
enddef
|
||||
|
||||
|
||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||
|
Reference in New Issue
Block a user