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

patch 8.2.2308: Vim9: no error when assigning lambda to funcref

Problem:    Vim9: no error when assigning lambda to funcref without return
            value.
Solution:   Default return value to "any". (closes #7629)
This commit is contained in:
Bram Moolenaar
2021-01-07 19:23:08 +01:00
parent ebbf11c119
commit 328eac2b5d
5 changed files with 16 additions and 4 deletions

View File

@@ -1091,6 +1091,13 @@ def Test_assign_lambda()
assert_equal(123, FuncRef_Any())
END
CheckScriptSuccess(lines)
lines =<< trim END
var Ref: func(number)
Ref = (j) => !j
END
CheckDefFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(any): bool')
CheckScriptFailure(['vim9script'] + lines, 'E1012: Type mismatch; expected func(number) but got func(any): any')
enddef
def Test_heredoc()