forked from aniani/vim
patch 9.0.2057: Vim9: no strict type checks for funcrefs varargs
Problem: Vim9: no strict type checks for funcrefs varargs
Solution: Perform strict type checking when declaring funcrefs
with vararg declaration, add tests
closes: #13397
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
committed by
Christian Brabandt
parent
d3e277f279
commit
3ec6c1fe3b
@@ -1890,7 +1890,7 @@ def Test_assign_funcref_args()
|
||||
var FuncAnyVA: func(...any): number
|
||||
FuncAnyVA = (v): number => v
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(any): number')
|
||||
v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any')
|
||||
|
||||
# varargs must match
|
||||
lines =<< trim END
|
||||
@@ -1898,7 +1898,7 @@ def Test_assign_funcref_args()
|
||||
var FuncAnyVA: func(...any): number
|
||||
FuncAnyVA = (v1, v2): number => v1 + v2
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(any, any): number')
|
||||
v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any')
|
||||
|
||||
# varargs must match
|
||||
lines =<< trim END
|
||||
@@ -1906,7 +1906,7 @@ def Test_assign_funcref_args()
|
||||
var FuncAnyVA: func(...any): number
|
||||
FuncAnyVA = (v1: list<any>): number => 3
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(list<any>): number')
|
||||
v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any')
|
||||
enddef
|
||||
|
||||
def Test_assign_funcref_arg_any()
|
||||
|
||||
Reference in New Issue
Block a user