0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1861: Vim9: no specific error when parsing lambda fails

Problem:    Vim9: no specific error when parsing lambda fails.
Solution:   Also give syntax errors when not evaluating. (closes #7154)
This commit is contained in:
Bram Moolenaar
2020-10-18 18:03:17 +02:00
parent 335e671322
commit a2c026d0fd
3 changed files with 20 additions and 19 deletions

View File

@@ -1805,6 +1805,13 @@ def Test_expr7_lambda()
CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x', 'y')"],
'E1106: 2 arguments too many')
CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1)
CheckDefSuccess(['var Fx = {a -> #{k1: 0,', ' k2: 1}}'])
CheckDefFailure(['var Fx = {a -> #{k1: 0', ' k2: 1}}'], 'E722:', 2)
CheckDefFailure(['var Fx = {a -> #{k1: 0,', ' k2 1}}'], 'E720:', 2)
CheckDefSuccess(['var Fx = {a -> [0,', ' 1]}'])
CheckDefFailure(['var Fx = {a -> [0', ' 1]}'], 'E696:', 2)
enddef
def Test_expr7_lambda_vim9script()
@@ -2371,7 +2378,7 @@ func Test_expr7_fails()
call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1)
call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2)
call CheckDefExecFailure(["#{a: 1->len()"], 'E488:', 1)
call CheckDefExecFailure(["#{a: 1->len()"], 'E722:', 1)
call CheckDefExecFailure(["{'a': 1->len()"], 'E723:', 2)
endfunc