comparison src/testdir/test_vim9_import.vim @ 30057:9c141768fa0f v9.0.0366

patch 9.0.0366: cannot use import->Func() in lambda Commit: https://github.com/vim/vim/commit/6ac69ed9a23fcbccc54574ded1cbab5065e19c41 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 3 12:09:07 2022 +0100 patch 9.0.0366: cannot use import->Func() in lambda Problem: Cannot use import->Func() in lambda. (Israel Chauca Fuentes) Solution: Adjust how an expression in a lambda is parsed. (closes https://github.com/vim/vim/issues/11042)
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Sep 2022 13:15:03 +0200
parents 13b02c1ea0f7
children 12e6c7bae2a9
comparison
equal deleted inserted replaced
30056:00b848e13d66 30057:9c141768fa0f
1452 1452
1453 delete('Xsuggest.vim') 1453 delete('Xsuggest.vim')
1454 set nospell spellsuggest& verbose=0 1454 set nospell spellsuggest& verbose=0
1455 enddef 1455 enddef
1456 1456
1457 def Test_import_in_lambda_method()
1458 var lines =<< trim END
1459 vim9script
1460 export def Retarg(e: any): any
1461 return e
1462 enddef
1463 END
1464 writefile(lines, 'XexportRetarg.vim')
1465 lines =<< trim END
1466 vim9script
1467 import './XexportRetarg.vim'
1468 def Lambda(): string
1469 var F = (x) => x->XexportRetarg.Retarg()
1470 return F('arg')
1471 enddef
1472 assert_equal('arg', Lambda())
1473 END
1474 v9.CheckScriptSuccess(lines)
1475
1476 delete('XexportRetarg.vim')
1477 enddef
1478
1457 def Test_export_shadows_global_function() 1479 def Test_export_shadows_global_function()
1458 mkdir('Xglobdir/autoload', 'p') 1480 mkdir('Xglobdir/autoload', 'p')
1459 var save_rtp = &rtp 1481 var save_rtp = &rtp
1460 exe 'set rtp^=' .. getcwd() .. '/Xglobdir' 1482 exe 'set rtp^=' .. getcwd() .. '/Xglobdir'
1461 1483