Re: Patch 7.4.1582

2016-03-20 Fir de Conversatie Bram Moolenaar

Kent Sibilev wrote:

> > > > > On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar 
> > > > > wrote:
> > > > > > Patch 7.4.1582
> > > > > > Problem:Get E923 when using function(dict.func, [], dict). 
> > > > > > (Kent Sibilev)
> > > > > > Storing a function with a dict in a variable drops the 
> > > > > > dict if the
> > > > > > function is script-local.
> > > > > > Solution:   Translate the function name.  Use dict arg if present.
> > > > > > Files:  src/eval.c, src/testdir/test_partial.vim
> > > > > > 
> > > > > > 
> > > > > 
> > > > > This change introduced another bug:
> > > > > 
> > > > > function! s:MyFunc(bang, buffer)
> > > > >   echo a:bang . a:buffer
> > > > > endfunction
> > > > > command! -bang -complete=buffer -nargs=? MyFunc call 
> > > > > s:MyFunc('', '')
> > > > > command! -bang -complete=buffer -nargs=? MyFuncBug call 
> > > > > MyFunc('', '')
> > > > > 
> > > > > 
> > > > > Calling MyFunc command works fine. Calling MyFuncBug command triggers
> > > > > E116 error.
> > > > 
> > > > I cannot reproduce that problem.  Not sure if your situation is
> > > > different or a later patch fixed it.
> > > > 
> > > > -- 
> > > 
> > > Hm, :version says I'm running 1-1586 and I can consistently reproduce
> > > it. Strange.
> > 
> > What is the command you give then?  Does it matter if you type it or put
> > it in the same script as s:MyFunc()?
> > 
> > -- 
> 
> When I execute MyFunc command, it works:
> 
> :MyFunc /tmp
> /tmp
> 
> When I execute MyFuncBug command, it produces an error:
> 
> :MyFuncBug /tmp
> E116: Invalid arguments for function 164_MyFunc

Still can't reproduce it.  Can you start with "vim -u NONE" to rule out
other plugins?

-- 
hundred-and-one symptoms of being an internet addict:
73. You give your dog used motherboards instead of bones

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1582

2016-03-20 Fir de Conversatie Kent Sibilev
On Thursday, March 17, 2016 at 5:07:25 PM UTC-4, Bram Moolenaar wrote:
> Kent Sibilev wrote:
> 
> > On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar wrote:
> > > Patch 7.4.1582
> > > Problem:Get E923 when using function(dict.func, [], dict). (Kent 
> > > Sibilev)
> > > Storing a function with a dict in a variable drops the dict 
> > > if the
> > > function is script-local.
> > > Solution:   Translate the function name.  Use dict arg if present.
> > > Files:  src/eval.c, src/testdir/test_partial.vim
> > > 
> > > 
> > 
> > This change introduced another bug:
> > 
> > function! s:MyFunc(bang, buffer)
> >   echo a:bang . a:buffer
> > endfunction
> > command! -bang -complete=buffer -nargs=? MyFunc call s:MyFunc('', 
> > '')
> > command! -bang -complete=buffer -nargs=? MyFuncBug call 
> > MyFunc('', '')
> > 
> > 
> > Calling MyFunc command works fine. Calling MyFuncBug command triggers
> > E116 error.
> 
> I cannot reproduce that problem.  Not sure if your situation is
> different or a later patch fixed it.
> 
> -- 

Hm, :version says I'm running 1-1586 and I can consistently reproduce it. 
Strange.

BR,
Kent

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1582

2016-03-19 Fir de Conversatie Bram Moolenaar

Kent Sibilev wrote:

> On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar wrote:
> > Patch 7.4.1582
> > Problem:Get E923 when using function(dict.func, [], dict). (Kent 
> > Sibilev)
> > Storing a function with a dict in a variable drops the dict if 
> > the
> > function is script-local.
> > Solution:   Translate the function name.  Use dict arg if present.
> > Files:  src/eval.c, src/testdir/test_partial.vim
> > 
> > 
> 
> This change introduced another bug:
> 
> function! s:MyFunc(bang, buffer)
>   echo a:bang . a:buffer
> endfunction
> command! -bang -complete=buffer -nargs=? MyFunc call s:MyFunc('', 
> '')
> command! -bang -complete=buffer -nargs=? MyFuncBug call MyFunc('', 
> '')
> 
> 
> Calling MyFunc command works fine. Calling MyFuncBug command triggers
> E116 error.

I cannot reproduce that problem.  Not sure if your situation is
different or a later patch fixed it.

-- 
I got a new desk stapler. It broke on the first desk I tried.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1582

2016-03-19 Fir de Conversatie Kent Sibilev
On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar wrote:
> Patch 7.4.1582
> Problem:Get E923 when using function(dict.func, [], dict). (Kent Sibilev)
> Storing a function with a dict in a variable drops the dict if the
> function is script-local.
> Solution:   Translate the function name.  Use dict arg if present.
> Files:  src/eval.c, src/testdir/test_partial.vim
> 
> 

This change introduced another bug:

function! s:MyFunc(bang, buffer)
  echo a:bang . a:buffer
endfunction
command! -bang -complete=buffer -nargs=? MyFunc call s:MyFunc('', 
'')
command! -bang -complete=buffer -nargs=? MyFuncBug call MyFunc('', 
'')


Calling MyFunc command works fine. Calling MyFuncBug command triggers E116 
error.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1582

2016-03-19 Fir de Conversatie Bram Moolenaar

Patch 7.4.1582
Problem:Get E923 when using function(dict.func, [], dict). (Kent Sibilev)
Storing a function with a dict in a variable drops the dict if the
function is script-local.
Solution:   Translate the function name.  Use dict arg if present.
Files:  src/eval.c, src/testdir/test_partial.vim


*** ../vim-7.4.1581/src/eval.c  2016-03-16 21:40:25.908329269 +0100
--- src/eval.c  2016-03-16 22:47:21.014095263 +0100
***
*** 110,116 
  #ifdef FEAT_FLOAT
  static char *e_float_as_string = N_("E806: using Float as a String");
  #endif
- static char *e_dict_both = N_("E924: can't have both a \"self\" dict and a 
partial: %s");
  
  #define NAMESPACE_CHAR(char_u *)"abglstvw"
  
--- 110,115 
***
*** 8678,8705 
  return ret;
  }
  
- 
- /*
-  * Call a function with its resolved parameters
-  * Return FAIL when the function can't be called,  OK otherwise.
-  * Also returns OK when an error was encountered while executing the function.
-  */
- int
- call_func(
- char_u*funcname,  /* name of the function */
- int   len,/* length of "name" */
- typval_T  *rettv, /* return value goes here */
- int   argcount_in,/* number of "argvars" */
- typval_T  *argvars_in,/* vars for arguments, must have "argcount"
-  PLUS ONE elements! */
- linenr_T  firstline,  /* first line of range */
- linenr_T  lastline,   /* last line of range */
- int   *doesrange, /* return: function handled range */
- int   evaluate,
- partial_T *partial,   /* optional, can be NULL */
- dict_T*selfdict_in)   /* Dictionary for "self" */
- {
- int   ret = FAIL;
  #define ERROR_UNKNOWN 0
  #define ERROR_TOOMANY 1
  #define ERROR_TOOFEW  2
--- 8677,8682 
***
*** 8707,8738 
  #define ERROR_DICT4
  #define ERROR_NONE5
  #define ERROR_OTHER   6
- #define ERROR_BOTH7
- int   error = ERROR_NONE;
- int   i;
- int   llen;
- ufunc_T   *fp;
  #define FLEN_FIXED 40
- char_ufname_buf[FLEN_FIXED + 1];
- char_u*fname;
- char_u*name;
- int   argcount = argcount_in;
- typval_T  *argvars = argvars_in;
- dict_T*selfdict = selfdict_in;
- typval_T  argv[MAX_FUNC_ARGS + 1]; /* used when "partial" is not NULL */
- int   argv_clear = 0;
  
! /* Make a copy of the name, if it comes from a funcref variable it could
!  * be changed or deleted in the called function. */
! name = vim_strnsave(funcname, len);
! if (name == NULL)
!   return ret;
  
- /*
-  * In a script change name() and s:name() to K_SNR 123_name().
-  * Change 123_name() to K_SNR 123_name().
-  * Use fname_buf[] when it fits, otherwise allocate memory (slow).
-  */
  llen = eval_fname_script(name);
  if (llen > 0)
  {
--- 8684,8704 
  #define ERROR_DICT4
  #define ERROR_NONE5
  #define ERROR_OTHER   6
  #define FLEN_FIXED 40
  
! /*
!  * In a script change name() and s:name() to K_SNR 123_name().
!  * Change 123_name() to K_SNR 123_name().
!  * Use "fname_buf[FLEN_FIXED + 1]" when it fits, otherwise allocate memory
!  * (slow).
!  */
! static char_u *
! fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error)
! {
! int   llen;
! char_u*fname;
! int   i;
  
  llen = eval_fname_script(name);
  if (llen > 0)
  {
***
*** 8743,8749 
if (eval_fname_sid(name))   /* "" or "s:" */
{
if (current_SID <= 0)
!   error = ERROR_SCRIPT;
else
{
sprintf((char *)fname_buf + 3, "%ld_", (long)current_SID);
--- 8709,8715 
if (eval_fname_sid(name))   /* "" or "s:" */
{
if (current_SID <= 0)
!   *error = ERROR_SCRIPT;
else
{
sprintf((char *)fname_buf + 3, "%ld_", (long)current_SID);
***
*** 8759,8767 
{
fname = alloc((unsigned)(i + STRLEN(name + llen) + 1));
if (fname == NULL)
!   error = ERROR_OTHER;
else
{
mch_memmove(fname, fname_buf, (size_t)i);
STRCPY(fname + i, name + llen);
}
--- 8725,8734 
{
fname = alloc((unsigned)(i + STRLEN(name + llen) + 1));
if (fname == NULL)
!   *error = ERROR_OTHER;
else
{
+   *tofree = fname;
mch_memmove(fname, fname_buf, (size_t)i);
ST

Re: Patch 7.4.1582

2016-03-19 Fir de Conversatie Kent Sibilev
On Thursday, March 17, 2016 at 6:26:05 PM UTC-4, Kent Sibilev wrote:

> 
> When I execute MyFunc command, it works:
> 
> :MyFunc /tmp
> /tmp
> 
> When I execute MyFuncBug command, it produces an error:
> 
> :MyFuncBug /tmp
> E116: Invalid arguments for function 164_MyFunc

It looks like path 1589 has fixed this problem.

BR,
Kent.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1582

2016-03-18 Fir de Conversatie Bram Moolenaar

Kent Sibilev wrote:

> > > On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar wrote:
> > > > Patch 7.4.1582
> > > > Problem:Get E923 when using function(dict.func, [], dict). (Kent 
> > > > Sibilev)
> > > > Storing a function with a dict in a variable drops the dict 
> > > > if the
> > > > function is script-local.
> > > > Solution:   Translate the function name.  Use dict arg if present.
> > > > Files:  src/eval.c, src/testdir/test_partial.vim
> > > > 
> > > > 
> > > 
> > > This change introduced another bug:
> > > 
> > > function! s:MyFunc(bang, buffer)
> > >   echo a:bang . a:buffer
> > > endfunction
> > > command! -bang -complete=buffer -nargs=? MyFunc call s:MyFunc('', 
> > > '')
> > > command! -bang -complete=buffer -nargs=? MyFuncBug call 
> > > MyFunc('', '')
> > > 
> > > 
> > > Calling MyFunc command works fine. Calling MyFuncBug command triggers
> > > E116 error.
> > 
> > I cannot reproduce that problem.  Not sure if your situation is
> > different or a later patch fixed it.
> > 
> > -- 
> 
> Hm, :version says I'm running 1-1586 and I can consistently reproduce
> it. Strange.

What is the command you give then?  Does it matter if you type it or put
it in the same script as s:MyFunc()?

-- 
"Thou shalt not follow the Null Pointer, for at its end Chaos and
Madness lie."

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1582

2016-03-18 Fir de Conversatie Kent Sibilev
On Thursday, March 17, 2016 at 6:22:25 PM UTC-4, Bram Moolenaar wrote:
> Kent Sibilev wrote:
> 
> > > > On Wednesday, March 16, 2016 at 5:52:38 PM UTC-4, Bram Moolenaar wrote:
> > > > > Patch 7.4.1582
> > > > > Problem:Get E923 when using function(dict.func, [], dict). (Kent 
> > > > > Sibilev)
> > > > > Storing a function with a dict in a variable drops the 
> > > > > dict if the
> > > > > function is script-local.
> > > > > Solution:   Translate the function name.  Use dict arg if present.
> > > > > Files:  src/eval.c, src/testdir/test_partial.vim
> > > > > 
> > > > > 
> > > > 
> > > > This change introduced another bug:
> > > > 
> > > > function! s:MyFunc(bang, buffer)
> > > >   echo a:bang . a:buffer
> > > > endfunction
> > > > command! -bang -complete=buffer -nargs=? MyFunc call s:MyFunc('', 
> > > > '')
> > > > command! -bang -complete=buffer -nargs=? MyFuncBug call 
> > > > MyFunc('', '')
> > > > 
> > > > 
> > > > Calling MyFunc command works fine. Calling MyFuncBug command triggers
> > > > E116 error.
> > > 
> > > I cannot reproduce that problem.  Not sure if your situation is
> > > different or a later patch fixed it.
> > > 
> > > -- 
> > 
> > Hm, :version says I'm running 1-1586 and I can consistently reproduce
> > it. Strange.
> 
> What is the command you give then?  Does it matter if you type it or put
> it in the same script as s:MyFunc()?
> 
> -- 

When I execute MyFunc command, it works:

:MyFunc /tmp
/tmp

When I execute MyFuncBug command, it produces an error:

:MyFuncBug /tmp
E116: Invalid arguments for function 164_MyFunc

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.