mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.1722: Vim9: cannot assign a lambda to a variable of type function
Problem: Vim9: cannot assign a lambda to a variable of type function. Solution: Allow for assigning a partial to a variable of type function. (Naruhiko Nishino, closes #6996)
This commit is contained in:
@@ -1687,6 +1687,18 @@ def Test_expr7_lambda_vim9script()
|
||||
->map({_, v -> synIDattr(v, 'name')})->len()})
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
|
||||
# check if assign a lambda to a variable which type is func or any.
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let FuncRef = {->123}
|
||||
assert_equal(123, FuncRef())
|
||||
let FuncRef_Func: func = {->123}
|
||||
assert_equal(123, FuncRef_Func())
|
||||
let FuncRef_Any: any = {->123}
|
||||
assert_equal(123, FuncRef_Any())
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_epxr7_funcref()
|
||||
|
Reference in New Issue
Block a user