patch 8.2.2809: Vim9: :def function compilation fails when using :legacy
Problem: Vim9: :def function compilation fails when using :legacy.
Solution: Reset CMOD_LEGACY when compiling a function. (closes #8137)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 230de20..5bfad6b 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2167,10 +2167,20 @@
def Test_legacy_lambda()
legacy echo {x -> 'hello ' .. x}('foo')
+
var lines =<< trim END
echo {x -> 'hello ' .. x}('foo')
END
CheckDefAndScriptFailure(lines, 'E720:')
+
+ lines =<< trim END
+ vim9script
+ def Func()
+ echo (() => 'no error')()
+ enddef
+ legacy call s:Func()
+ END
+ CheckScriptSuccess(lines)
enddef
def DoFilterThis(a: string): list<string>