diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-03 12:09:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-03 12:09:07 +0100 |
commit | 6ac69ed9a23fcbccc54574ded1cbab5065e19c41 (patch) | |
tree | 933e6d9b26eaa6665da58cfc72c47fc765861fb7 /src/testdir | |
parent | 91a874eb88eff2df9b8fdd64ccf98eed337823cf (diff) |
patch 9.0.0366: cannot use import->Func() in lambdav9.0.0366
Problem: Cannot use import->Func() in lambda. (Israel Chauca Fuentes)
Solution: Adjust how an expression in a lambda is parsed. (closes #11042)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_import.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim index b688296f36..e844d4a082 100644 --- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -1454,6 +1454,28 @@ def Run_Test_import_in_spellsuggest_expr() set nospell spellsuggest& verbose=0 enddef +def Test_import_in_lambda_method() + var lines =<< trim END + vim9script + export def Retarg(e: any): any + return e + enddef + END + writefile(lines, 'XexportRetarg.vim') + lines =<< trim END + vim9script + import './XexportRetarg.vim' + def Lambda(): string + var F = (x) => x->XexportRetarg.Retarg() + return F('arg') + enddef + assert_equal('arg', Lambda()) + END + v9.CheckScriptSuccess(lines) + + delete('XexportRetarg.vim') +enddef + def Test_export_shadows_global_function() mkdir('Xglobdir/autoload', 'p') var save_rtp = &rtp |