1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2021-03-11 20:04:04 +01:00
parent 776b954622
commit 12bce95887
3 changed files with 20 additions and 1 deletions

View File

@@ -311,6 +311,14 @@ def Test_call_default_args()
delfunc g:Func
CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: Argument 1: type mismatch, expected number but got string')
delfunc g:Func
var lines =<< trim END
vim9script
def Func(a = b == 0 ? 1 : 2, b = 0)
enddef
defcompile
END
CheckScriptFailure(lines, 'E1001: Variable not found: b')
enddef
def FuncWithComment( # comment