0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1300: Vim9: optional argument type not parsed properly

Problem:    Vim9: optional argument type not parsed properly.
Solution:   Skip over the "?". (issue #6507)
This commit is contained in:
Bram Moolenaar
2020-07-26 17:56:25 +02:00
parent 2547aa930b
commit 4fc224ca1c
6 changed files with 37 additions and 11 deletions

View File

@@ -350,6 +350,19 @@ def Test_call_funcref()
let Funcref: func(string) = function('UseNumber')
END
CheckScriptFailure(lines, 'E1013: type mismatch, expected func(string) but got func(number)')
lines =<< trim END
vim9script
def EchoNr(nr = 34)
g:echo = nr
enddef
let Funcref: func(?number) = function('EchoNr')
Funcref()
assert_equal(34, g:echo)
Funcref(123)
assert_equal(123, g:echo)
END
CheckScriptSuccess(lines)
enddef
let SomeFunc = function('len')