This change doesn't allow functions like this:
function! s:cache_clear(...) dict
function! rails#cache_clear(...)
to be defined at the same time. Any particular reason for this, cause this change breaks vim-rails plugin.
Thanks,
Kent Sibilev
I think this patch is the cause for breaking plugins like incsearch.vim and vim-easymotion. If I revert back to 7.4.1576, then it works again.
I included the errors I got, the these plugins are massive I think, and would probably be really hard to track down unless you are the author.
It mainly seems to be variations of this:
E924: can't have both a "self" dict and a partial
https://gist.github.com/raymond-w-ko/3af7260575b9bea172ad
https://gist.github.com/raymond-w-ko/de9712e077221837ebf5
I get less errors, but plugins are still broken for me.
After getting these errors, eventually I get a fatal error:
Vim: Caught deadly signal SEGV
which probably means there is something wrong with the error handling cases?
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
E924: can't have both a "self" dict and a partial: 268
Error detected while processing function incsearch#_go[5]..<SNR>143_get_input[12]..288:
line 4:
E924: can't have both a "self" dict and a partial: 286
Error detected while processing function incsearch#_go[5]..<SNR>143_get_input:
line 12:
E171: Missing :endif
2016/3/16 Wed 3:33:55 UTC+9 Bram Moolenaar wrote:
> Patch 7.4.1577
> Problem: Cannot pass "dict.Myfunc" around as a partial.
> Solution: Create a partial when expected.
> Files: src/eval.c, src/testdir/test_partial.vim
> + if (rettv->v_type == VAR_FUNC && selfdict != NULL)
> + {
> + partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T));
> +
> + /* Turn "dict.Func" into a partial for "Func" with "dict". */
> + if (pt != NULL)
> + {
> + pt->pt_dict = selfdict;
> + selfdict = NULL;
> + pt->pt_name = rettv->vval.v_string;
> + func_ref(pt->pt_name);
> + rettv->v_type = VAR_PARTIAL;
> + rettv->vval.v_partial = pt;
> + }
> + }
I'm not sure, but it seems that this if block has some problems.
When I comment out this block, the issue #690 disappears (even without mattn's
patch).
Regards,
Ken Takata
Ah! How about this.
--- a/src/eval.c
+++ b/src/eval.c
@@ -21733,6 +21733,7 @@ handle_subscript(
pt->pt_dict = selfdict;
selfdict = NULL;
pt->pt_name = rettv->vval.v_string;
+ pt->pt_refcount = 1;
func_ref(pt->pt_name);
rettv->v_type = VAR_PARTIAL;
rettv->vval.v_partial = pt;
Regards,
Ken Takata
Here is the small script to reproduce:
function s:cache_clear(...) dict
return self.name
endfunction
function! s:function(name)
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
endfunction
let s:obj = {'name': 'cache'}
let s:obj['clear'] = s:function('s:cache_clear')
" this works
echo s:obj.clear()
" this fails with E924
echo call(s:obj.clear, [], s:obj)