Salman Halim wrote:
> I'm getting this error in my Vim 9 script in Windows GVim 8.2.2912:
>
> Error detected while compiling
> C:/vim/Vimfiles/plugin/Test.vim[17]..function TestBrokenCall:
> line 8:
> E1013: Argument 3: type mismatch, expected string but got bool
>
> Here is a simple duplication script:
>
> vim9script
>
> export def g:BrokenCall( lineNumber: number, insertMode: bool,
> templateToUse: string = 'defaultValue' ): void
> echo lineNumber
> echo insertMode
> echo templateToUse
> enddef
>
> export def g:TestBrokenCall( line1: number, line2: number, templateName:
> string ): void
> # This works
> # call BrokenCall( line1, 0 )
>
> # This results in
> # Error detected while compiling
> C:/vim/Vimfiles/plugin/Test.vim[17]..function TestBrokenCall:
> # line 8:
> # E1013: Argument 3: type mismatch, expected string but got bool
> call BrokenCall( line1, 0, templateName )
> enddef
>
> call TestBrokenCall(3, 5, 'ab')
>
> Calling BrokenCall with just two arguments works, but passing in the third
> argument doesn't. The third argument can be a hard-coded string or the
> variable. Similarly, having BrokenCall contain a default value for the
> third parameter doesn't seem to matter, either.
I can reproduce it. The "export" and "g:" are not needed.
The problem is that converting the number zero to a bool is done at the
wrong stack offset. I'll make a patch.
--
Living on Earth includes an annual free trip around the Sun.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202106041847.154IlHVZ3180582%40masaka.moolenaar.net.
No comments:
Post a Comment