forked from aniani/vim
patch 8.2.1131: Vim9: error message for returning a value is not clear
Problem: Vim9: error message for returning a value in a function that does not return anything is not clear. Solution: Add a specific message.
This commit is contained in:
@@ -286,14 +286,14 @@ enddef
|
||||
|
||||
def Test_error_in_nested_function()
|
||||
" Error in called function requires unwinding the call stack.
|
||||
assert_fails('call FuncWithForwardCall()', 'E1013')
|
||||
assert_fails('call FuncWithForwardCall()', 'E1096')
|
||||
enddef
|
||||
|
||||
def Test_return_type_wrong()
|
||||
CheckScriptFailure(['def Func(): number', 'return "a"', 'enddef', 'defcompile'], 'expected number but got string')
|
||||
CheckScriptFailure(['def Func(): string', 'return 1', 'enddef', 'defcompile'], 'expected string but got number')
|
||||
CheckScriptFailure(['def Func(): void', 'return "a"', 'enddef', 'defcompile'], 'expected void but got string')
|
||||
CheckScriptFailure(['def Func()', 'return "a"', 'enddef', 'defcompile'], 'expected void but got string')
|
||||
CheckScriptFailure(['def Func(): void', 'return "a"', 'enddef', 'defcompile'], 'E1096: Returning a value in a function without a return type')
|
||||
CheckScriptFailure(['def Func()', 'return "a"', 'enddef', 'defcompile'], 'E1096: Returning a value in a function without a return type')
|
||||
|
||||
CheckScriptFailure(['def Func(): number', 'return', 'enddef', 'defcompile'], 'E1003:')
|
||||
|
||||
|
Reference in New Issue
Block a user