Friday, June 4, 2021

Error message in Vim 9 script

Hello,

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.

Thank you,

Salman

--
 
Salman

I, too, shall something make and glory in the making.

--
--
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/CANuxnEdHaR73_LPQVGM3qcav4_%2Bx3bs7SZNf_sfyNtYr2Sv2Pw%40mail.gmail.com.

No comments: