0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number

Problem:    Vim9: when compiling repeat(123, N) return type is number.
Solution:   Make return type a string. (closes #8664)
This commit is contained in:
Bram Moolenaar
2021-07-31 22:03:59 +02:00
parent 335c8c7b20
commit 1780f08ba4
3 changed files with 19 additions and 4 deletions

View File

@@ -2558,9 +2558,15 @@ enddef
def Test_repeat()
CheckDefAndScriptFailure2(['repeat(1.1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1224: String, Number or List required for argument 1')
CheckDefAndScriptFailure2(['repeat({a: 10}, 2)'], 'E1013: Argument 1: type mismatch, expected string but got dict<', 'E1224: String, Number or List required for argument 1')
assert_equal('aaa', repeat('a', 3))
assert_equal('111', repeat(1, 3))
assert_equal([1, 1, 1], repeat([1], 3))
var lines =<< trim END
assert_equal('aaa', repeat('a', 3))
assert_equal('111', repeat(1, 3))
assert_equal([1, 1, 1], repeat([1], 3))
var s = '-'
s ..= repeat(5, 3)
assert_equal('-555', s)
END
CheckDefAndScriptSuccess(lines)
enddef
def Test_resolve()