comparison src/testdir/test_vim9_func.vim @ 24097:26d3c1539bcc v8.2.2590

patch 8.2.2590: Vim9: default argument value may cause internal error Commit: https://github.com/vim/vim/commit/12bce95887f7c5f07a7bdb7b4485b53d074ccc0a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 11 20:04:04 2021 +0100 patch 8.2.2590: Vim9: default argument value may cause internal error Problem: Vim9: default argument value may cause internal error. Solution: Hide later function arguments when compiling the expression. (closes #7948)
author Bram Moolenaar <Bram@vim.org>
date Thu, 11 Mar 2021 20:15:05 +0100
parents 324408c61b20
children c308076e225e
comparison
equal deleted inserted replaced
24096:8c4686919942 24097:26d3c1539bcc
309 309
310 CheckScriptFailure(['def Func(arg: number = asdf)', 'enddef', 'defcompile'], 'E1001:') 310 CheckScriptFailure(['def Func(arg: number = asdf)', 'enddef', 'defcompile'], 'E1001:')
311 delfunc g:Func 311 delfunc g:Func
312 CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: Argument 1: type mismatch, expected number but got string') 312 CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: Argument 1: type mismatch, expected number but got string')
313 delfunc g:Func 313 delfunc g:Func
314
315 var lines =<< trim END
316 vim9script
317 def Func(a = b == 0 ? 1 : 2, b = 0)
318 enddef
319 defcompile
320 END
321 CheckScriptFailure(lines, 'E1001: Variable not found: b')
314 enddef 322 enddef
315 323
316 def FuncWithComment( # comment 324 def FuncWithComment( # comment
317 a: number, #comment 325 a: number, #comment
318 b: bool, # comment 326 b: bool, # comment