0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.3945: Vim9: partial variable argument types are wrong

Problem:    Vim9: partial variable argument types are wrong, leading to a
            crash.
Solution:   When adjusting the argument count also adjust the argument types.
            (closes #9433)
This commit is contained in:
Bram Moolenaar
2021-12-30 13:29:00 +00:00
parent 5d2e007ccb
commit 13789bf103
4 changed files with 53 additions and 0 deletions

View File

@@ -847,6 +847,36 @@ def Test_assignment_partial()
Ref()
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
var nres: any
var sres: any
def Func(n: number, s = '')
nres = n
sres = s
enddef
var n: number
var Ref = function(Func, [n])
Ref('x')
assert_equal(0, nres)
assert_equal('x', sres)
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
def Func(n: number, s = '')
enddef
var n: number
var Ref = function(Func, [n])
Ref(0)
END
CheckScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected string but got number')
enddef
def Test_assignment_list_any_index()