1
0
forked from aniani/vim

patch 8.2.2387: runtime type check does not mention argument index

Problem:    Runtime type check does not mention argument index.
Solution:   Add ct_arg_idx. (closes #7720)
This commit is contained in:
Bram Moolenaar
2021-01-21 20:21:29 +01:00
parent f904133e1a
commit e32e516dfa
7 changed files with 41 additions and 12 deletions

View File

@@ -144,6 +144,22 @@ def Test_return_something()
assert_fails('ReturnGlobal()', 'E1012: Type mismatch; expected number but got string', '', 1, 'ReturnGlobal')
enddef
def Test_check_argument_type()
var lines =<< trim END
vim9script
def Val(a: number, b: number): number
return 0
enddef
def Func()
var x: any = true
Val(0, x)
enddef
disass Func
Func()
END
CheckScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected number but got bool', 2)
enddef
def Test_missing_return()
CheckDefFailure(['def Missing(): number',
' if g:cond',