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:
@@ -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')
|
||||
|
Reference in New Issue
Block a user