1
0
forked from aniani/vim

patch 8.2.3084: Vim9: builtin function argument types are not checked

Problem:    Vim9: builtin function argument types are not checked at compile
            time.
Solution:   Add argument types. (Yegappan Lakshmanan, closes #8503)
This commit is contained in:
Yegappan Lakshmanan
2021-07-03 11:58:12 +02:00
committed by Bram Moolenaar
parent 72463f883c
commit a26f56f675
6 changed files with 645 additions and 146 deletions

View File

@@ -169,7 +169,8 @@ func Test_strwidth()
if has('float')
call assert_equal(3, strwidth(1.2))
call CheckDefExecAndScriptFailure(['echo strwidth(1.2)'], 'E806:')
call CheckDefFailure(['echo strwidth(1.2)'], 'E1013:')
call CheckScriptFailure(['vim9script', 'echo strwidth(1.2)'], 'E806:')
endif
set ambiwidth&
@@ -236,7 +237,7 @@ func Test_str2nr()
call assert_fails('call str2nr({->2})', 'E729:')
if has('float')
call assert_equal(1, str2nr(1.2))
call CheckDefExecFailure(['echo str2nr(1.2)'], 'E1013:')
call CheckDefFailure(['echo str2nr(1.2)'], 'E1013:')
call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:')
endif
call assert_fails('call str2nr(10, [])', 'E745:')
@@ -499,7 +500,8 @@ func Test_simplify()
call assert_fails('call simplify({})', 'E731:')
if has('float')
call assert_equal('1.2', simplify(1.2))
call CheckDefExecAndScriptFailure(['echo simplify(1.2)'], 'E806:')
call CheckDefFailure(['echo simplify(1.2)'], 'E1013:')
call CheckScriptFailure(['vim9script', 'echo simplify(1.2)'], 'E806:')
endif
endfunc