0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.1189: Vim9: line continuation in lambda doesn't always work

Problem:    Vim9: line continuation in lambda doesn't always work.
Solution:   Do not use a local evalarg unless there isn't one. (closes #6439)
This commit is contained in:
Bram Moolenaar
2020-07-12 16:32:19 +02:00
parent 6d3a7213f5
commit 8af81d656a
3 changed files with 141 additions and 109 deletions

View File

@@ -1071,6 +1071,27 @@ def Test_expr7_lambda()
assert_equal('result', La())
assert_equal([1, 3, 5], [1, 2, 3]->map({key, val -> key + val}))
" line continuation inside lambda with "cond ? expr : expr" works
let ll = range(3)
map(ll, {k, v -> v % 2 ? {
'111': 111 } : {}
})
assert_equal([{}, {'111': 111}, {}], ll)
ll = range(3)
map(ll, {k, v -> v == 8 || v
== 9
|| v % 2 ? 111 : 222
})
assert_equal([222, 111, 222], ll)
ll = range(3)
map(ll, {k, v -> v != 8 && v
!= 9
&& v % 2 == 0 ? 111 : 222
})
assert_equal([111, 222, 111], ll)
call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
enddef