Problem: Vim9: segfault with object comparisons
Solution: increment recusive_cnt before calling typval_compare_object()
(Ernie Rael)
closes: #15073
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
v9.CheckScriptFailure(lines, 'E1347: Not a valid interface: A', 3)
enddef
+" Test for comparing a class referencing itself
+def Test_Object_Compare_With_Recursive_Class_Ref()
+ var lines =<< trim END
+ vim9script
+
+ class C
+ public var nest: C
+ endclass
+
+ var o1 = C.new()
+ o1.nest = o1
+
+ var result = o1 == o1
+ assert_equal(true, result)
+ END
+ v9.CheckScriptSuccess(lines)
+enddef
+
" Test for using a compound operator from a lambda function in an object method
def Test_compound_op_in_objmethod_lambda()
# Test using the "+=" operator
return tv1->vval.v_class == tv2->vval.v_class;
case VAR_OBJECT:
+ ++recursive_cnt;
(void)typval_compare_object(tv1, tv2, EXPR_EQUAL, ic, &r);
+ --recursive_cnt;
return r;
case VAR_PARTIAL:
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 513,
/**/
512,
/**/