patch 9.0.0557: valgrind reports possibly leaked memory
Problem: Valgrind reports possibly leaked memory.
Solution: Move the problematic test function to the "fails" test file to
avoid obscuring real memory leaks.
diff --git a/src/testdir/test_vim9_fails.vim b/src/testdir/test_vim9_fails.vim
index 5c3cab5..9d43370 100644
--- a/src/testdir/test_vim9_fails.vim
+++ b/src/testdir/test_vim9_fails.vim
@@ -26,3 +26,37 @@
endif
enddef
+" Using "idx" from a legacy global function does not work.
+" This caused a crash when called from legacy context.
+" This creates a dict that contains a partial that refers to the dict, causing
+" valgrind to report "possibly leaked memory".
+func Test_partial_call_fails()
+ let lines =<< trim END
+ vim9script
+
+ var l = ['a', 'b', 'c']
+ def Iter(container: any): any
+ var idx = -1
+ var obj = {state: container}
+ def g:NextItem__(self: dict<any>): any
+ ++idx
+ return self.state[idx]
+ enddef
+ obj.__next__ = function('g:NextItem__', [obj])
+ return obj
+ enddef
+
+ var it = Iter(l)
+ echo it.__next__()
+ END
+ call writefile(lines, 'XpartialCall', 'D')
+ let caught = 'no'
+ try
+ source XpartialCall
+ catch /E1248:/
+ let caught = 'yes'
+ endtry
+ call assert_equal('yes', caught)
+ delfunc g:NextItem__
+endfunc
+