Skip to content

Commit b16a9dd

Browse files
thincachrisbra
authored andcommitted
patch 9.2.0574: tests: missing test for v9.2.0572
Problem: tests: missing test for v9.2.0572 (the patch accidentally included some additional unwanted changes from #20372) (thinca) Solution: Add additional test for delfunc (thinca) Patch 9.2.0572 fixed ":call d.key()" and ":delfunction d.key" failing with E1017 in Vim9 script, but only the :call form was covered by a regression test. Add Test_delfunction_dict_funcref to exercise both "delfunction d.key" and "delfunction d['k2']". closes: #20372 Signed-off-by: thinca <thinca@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 38d9a16 commit b16a9dd

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/testdir/test_vim9_cmd.vim

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,4 +2178,23 @@ def Test_call_dict_funcref()
21782178
v9.CheckScriptSuccess(lines)
21792179
enddef
21802180

2181+
" :delfunction on a funcref stored in a dict member used to fail with E1017 in
2182+
" Vim9 script for the same reason as :call.
2183+
def Test_delfunction_dict_funcref()
2184+
var lines =<< trim END
2185+
vim9script
2186+
func g:LegacyFunc()
2187+
endfunc
2188+
var d: dict<any> = {}
2189+
d.key = g:LegacyFunc
2190+
d['k2'] = g:LegacyFunc
2191+
delfunction d.key
2192+
assert_false(has_key(d, 'key'))
2193+
delfunction d['k2']
2194+
assert_false(has_key(d, 'k2'))
2195+
delfunction g:LegacyFunc
2196+
END
2197+
v9.CheckScriptSuccess(lines)
2198+
enddef
2199+
21812200
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
574,
732734
/**/
733735
573,
734736
/**/

0 commit comments

Comments
 (0)