patch 9.1.0524: the recursive parameter in the *_equal functions can be removed
Problem: the recursive parameter in the *_equal functions can be removed
Solution: Remove the recursive parameter in dict_equal(), list_equal()
object_equal and tv_equal(). Use a comparison of the static
var recursive_cnt == 0 to determine whether or not tv_equal()
has been called recursively (Yinzuo Jiang).
closes: #15070
Signed-off-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index f2d4a3e..0a4f88c 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1147,6 +1147,19 @@
call assert_fails('echo {} =~ {}', 'E736:')
endfunc
+func Test_recursive_listdict_compare()
+ let l1 = [0, 1]
+ let l1[0] = l1
+ let l2 = [0, 1]
+ let l2[0] = l2
+ call assert_true(l1 == l2)
+ let d1 = {0: 0, 1: 1}
+ let d1[0] = d1
+ let d2 = {0: 0, 1: 1}
+ let d2[0] = d2
+ call assert_true(d1 == d2)
+endfunc
+
" compare complex recursively linked list and dict
func Test_listdict_compare_complex()
let lines =<< trim END