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

patch 8.2.2325: Vim9: crash if map() changes the item type

Problem:    Vim9: crash if map() changes the item type.
Solution:   Check that the item type is still OK. (closes #7652)
            Fix problem with mapnew() on range list.
This commit is contained in:
Bram Moolenaar
2021-01-10 22:42:50 +01:00
parent 6f02b00bb0
commit 75ab91ff34
8 changed files with 50 additions and 18 deletions

View File

@@ -1859,10 +1859,10 @@ def Test_expr7_lambda()
# line continuation inside lambda with "cond ? expr : expr" works
var ll = range(3)
map(ll, (k, v) => v % 2 ? {
var dll = mapnew(ll, (k, v) => v % 2 ? {
['111']: 111 } : {}
)
assert_equal([{}, {111: 111}, {}], ll)
assert_equal([{}, {111: 111}, {}], dll)
ll = range(3)
map(ll, (k, v) => v == 8 || v
@@ -1946,10 +1946,10 @@ def Test_expr7_new_lambda()
# line continuation inside lambda with "cond ? expr : expr" works
var ll = range(3)
map(ll, (k, v) => v % 2 ? {
var dll = mapnew(ll, (k, v) => v % 2 ? {
['111']: 111 } : {}
)
assert_equal([{}, {111: 111}, {}], ll)
assert_equal([{}, {111: 111}, {}], dll)
ll = range(3)
map(ll, (k, v) => v == 8 || v
@@ -2964,25 +2964,25 @@ def Test_expr7_subscript_linebreak()
var range = range(
3)
var l = range
->map('string(v:key)')
->mapnew('string(v:key)')
assert_equal(['0', '1', '2'], l)
l = range
->map('string(v:key)')
->mapnew('string(v:key)')
assert_equal(['0', '1', '2'], l)
l = range # comment
->map('string(v:key)')
->mapnew('string(v:key)')
assert_equal(['0', '1', '2'], l)
l = range
->map('string(v:key)')
->mapnew('string(v:key)')
assert_equal(['0', '1', '2'], l)
l = range
# comment
->map('string(v:key)')
->mapnew('string(v:key)')
assert_equal(['0', '1', '2'], l)
assert_equal('1', l[