patch 8.1.1820: using expr->FuncRef() does not work
Problem: Using expr->FuncRef() does not work.
Solution: Make FuncRef work as a method.
diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim
index 93918c8..6d90a8f 100644
--- a/src/testdir/test_method.vim
+++ b/src/testdir/test_method.vim
@@ -1,6 +1,6 @@
" Tests for ->method()
-func Test_list()
+func Test_list_method()
let l = [1, 2, 3]
call assert_equal([1, 2, 3, 4], [1, 2, 3]->add(4))
eval l->assert_equal(l)
@@ -34,7 +34,7 @@
call assert_fails('eval l->values()', 'E715:')
endfunc
-func Test_dict()
+func Test_dict_method()
let d = #{one: 1, two: 2, three: 3}
call assert_equal(d, d->copy())
@@ -66,7 +66,7 @@
call assert_equal([1, 2, 3], d->values())
endfunc
-func Test_string()
+func Test_string_method()
call assert_equal(['1', '2', '3'], '1 2 3'->split())
call assert_equal([1, 2, 3], '1 2 3'->split()->map({i, v -> str2nr(v)}))
call assert_equal([65, 66, 67], 'ABC'->str2list())
@@ -76,7 +76,7 @@
call assert_equal('axc', 'abc'->substitute('b', 'x', ''))
endfunc
-func Test_append()
+func Test_method_append()
new
eval ['one', 'two', 'three']->append(1)
call assert_equal(['', 'one', 'two', 'three'], getline(1, '$'))
@@ -89,3 +89,16 @@
exe 'bwipe! ' .. bnr
endfunc
+
+func Test_method_funcref()
+ func Concat(one, two, three)
+ return a:one .. a:two .. a:three
+ endfunc
+ let FuncRef = function('Concat')
+ eval 'foo'->FuncRef('bar', 'tail')->assert_equal('foobartail')
+
+ let Partial = function('Concat', ['two'])
+ eval 'one'->Partial('three')->assert_equal('onetwothree')
+
+ delfunc Concat
+endfunc