0
0
mirror of https://github.com/vim/vim.git synced 2025-11-10 10:47:23 -05:00

patch 9.0.0703: failing check for argument type for const any

Problem:    Failing check for argument type for const any.
Solution:   Check for any type properly. (closes #11316)
This commit is contained in:
Bram Moolenaar
2022-10-09 12:55:33 +01:00
parent 30c0c467d6
commit 330d64d32c
5 changed files with 110 additions and 107 deletions

View File

@@ -305,6 +305,25 @@ def Test_const()
assert_equal(v:t_number, type(foo.bar))
END
v9.CheckDefAndScriptSuccess(lines)
# also when used as a builtin function argument
lines =<< trim END
vim9script
def SorterFunc(lhs: dict<string>, rhs: dict<string>): number
return lhs.name <# rhs.name ? -1 : 1
enddef
def Run(): void
var list = [{name: "3"}, {name: "2"}]
const Sorter = get({}, "unknown", SorterFunc)
sort(list, Sorter)
assert_equal([{name: "2"}, {name: "3"}], list)
enddef
Run()
END
v9.CheckScriptSuccess(lines)
enddef
def Test_const_bang()