diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-01 15:40:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-01 15:40:54 +0200 |
commit | 437bafe4c8a83ed71ee006eda7f54b65a90f0d4c (patch) | |
tree | dac9426b1bafe44f050bbb13c027de31117c089d /src/testdir | |
parent | 580164481924ed8611eb79f0247a0eb1ca0b3b9a (diff) |
patch 7.4.2137v7.4.2137
Problem: Using function() with a name will find another function when it is
redefined.
Solution: Add funcref(). Refer to lambda using a partial. Fix several
reference counting issues.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_expr.vim | 15 | ||||
-rw-r--r-- | src/testdir/test_lambda.vim | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index d8abc27523..0800039aee 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -179,3 +179,18 @@ func Test_function_with_funcref() call assert_equal(v:t_string, s:fref('x')) call assert_fails("call function('s:f')", 'E700:') endfunc + +func Test_funcref() + func! One() + return 1 + endfunc + let OneByName = function('One') + let OneByRef = funcref('One') + func! One() + return 2 + endfunc + call assert_equal(2, OneByName()) + call assert_equal(1, OneByRef()) + let OneByRef = funcref('One') + call assert_equal(2, OneByRef()) +endfunc diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim index 4d895460e5..721c47de11 100644 --- a/src/testdir/test_lambda.vim +++ b/src/testdir/test_lambda.vim @@ -152,7 +152,7 @@ function! Test_lambda_delfunc() endfunction let l:F = s:gen() - call assert_fails(':call l:F()', 'E117:') + call assert_fails(':call l:F()', 'E933:') endfunction function! Test_lambda_scope() |