Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 21969:ba2415df82d7 v8.2.1534
patch 8.2.1534: Vim9: type error for argument type is not at call position
Commit: https://github.com/vim/vim/commit/ee8580e52e767916e2a95e8ac0732fd8a5ae0651
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 28 17:19:07 2020 +0200
patch 8.2.1534: Vim9: type error for argument type is not at call position
Problem: Vim9: type error for argument type is not at call position.
Solution: Set the context and stack after checking the arguments.
(issue #6785)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 28 Aug 2020 17:30:04 +0200 |
parents | bf68435a695a |
children | c9517003821d |
comparison
equal
deleted
inserted
replaced
21968:613ecf205d6a | 21969:ba2415df82d7 |
---|---|
221 def Test_call_wrong_args() | 221 def Test_call_wrong_args() |
222 call CheckDefFailure(['TakesOneArg()'], 'E119:') | 222 call CheckDefFailure(['TakesOneArg()'], 'E119:') |
223 call CheckDefFailure(['TakesOneArg(11, 22)'], 'E118:') | 223 call CheckDefFailure(['TakesOneArg(11, 22)'], 'E118:') |
224 call CheckDefFailure(['bufnr(xxx)'], 'E1001:') | 224 call CheckDefFailure(['bufnr(xxx)'], 'E1001:') |
225 call CheckScriptFailure(['def Func(Ref: func(s: string))'], 'E475:') | 225 call CheckScriptFailure(['def Func(Ref: func(s: string))'], 'E475:') |
226 | |
227 let lines =<< trim END | |
228 vim9script | |
229 def Func(s: string) | |
230 echo s | |
231 enddef | |
232 Func([]) | |
233 END | |
234 call CheckScriptFailure(lines, 'E1012: type mismatch, expected string but got list<unknown>', 5) | |
226 enddef | 235 enddef |
227 | 236 |
228 " Default arg and varargs | 237 " Default arg and varargs |
229 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string | 238 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string |
230 let res = one .. ',' .. two | 239 let res = one .. ',' .. two |