comparison src/testdir/test_vim9_func.vim @ 26378:a926ccd92ae1 v8.2.3720

patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context Commit: https://github.com/vim/vim/commit/69c76171f1a78b829196f72d7010fbe1d9ad2944 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 2 16:38:52 2021 +0000 patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context Problem: Vim9: Internal error when invoking closure in legacy context. Solution: Give a more appropriate error message. (closes https://github.com/vim/vim/issues/9251)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Dec 2021 17:45:03 +0100
parents 3841da4eac23
children ff0310e6f889
comparison
equal deleted inserted replaced
26377:8c115ef03db5 26378:a926ccd92ae1
2382 END 2382 END
2383 CheckScriptSuccess(lines) 2383 CheckScriptSuccess(lines)
2384 delfunc g:Inner 2384 delfunc g:Inner
2385 enddef 2385 enddef
2386 2386
2387 def Test_closure_called_from_legacy()
2388 var lines =<< trim END
2389 vim9script
2390 def Func()
2391 var outer = 'foo'
2392 var F = () => {
2393 outer = 'bar'
2394 }
2395 execute printf('call %s()', string(F))
2396 enddef
2397 Func()
2398 END
2399 CheckScriptFailure(lines, 'E1248')
2400 enddef
2401
2387 def Test_failure_in_called_function() 2402 def Test_failure_in_called_function()
2388 # this was using the frame index as the return value 2403 # this was using the frame index as the return value
2389 var lines =<< trim END 2404 var lines =<< trim END
2390 vim9script 2405 vim9script
2391 au TerminalWinOpen * eval [][0] 2406 au TerminalWinOpen * eval [][0]