Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 24531:3bfec39ce31c v8.2.2805
patch 8.2.2805: Vim9: cannot use legacy syntax in Vim9 script
Commit: https://github.com/vim/vim/commit/96cf4ba8fb96e5778192d2dab7458b9a7da0a49d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 24 14:15:41 2021 +0200
patch 8.2.2805: Vim9: cannot use legacy syntax in Vim9 script
Problem: Vim9: cannot use legacy syntax in Vim9 script.
Solution: Add the :legacy command.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Apr 2021 14:30:04 +0200 |
parents | 887121a6d7cf |
children | 3a290891a015 |
comparison
equal
deleted
inserted
replaced
24530:51e01f7c2069 | 24531:3bfec39ce31c |
---|---|
2163 ->substitute("')", '', '') | 2163 ->substitute("')", '', '') |
2164 ->substitute('function\zs', ' ', '')) | 2164 ->substitute('function\zs', ' ', '')) |
2165 assert_match('def <lambda>\d\+(_: any): number\n1 return 0\n enddef', body) | 2165 assert_match('def <lambda>\d\+(_: any): number\n1 return 0\n enddef', body) |
2166 enddef | 2166 enddef |
2167 | 2167 |
2168 def Test_legacy_lambda() | |
2169 legacy echo {x -> 'hello ' .. x}('foo') | |
2170 var lines =<< trim END | |
2171 echo {x -> 'hello ' .. x}('foo') | |
2172 END | |
2173 CheckDefAndScriptFailure(lines, 'E720:') | |
2174 enddef | |
2175 | |
2168 def DoFilterThis(a: string): list<string> | 2176 def DoFilterThis(a: string): list<string> |
2169 # closure nested inside another closure using argument | 2177 # closure nested inside another closure using argument |
2170 var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0) | 2178 var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0) |
2171 return ['x', 'y', 'a', 'x2', 'c']->Filter() | 2179 return ['x', 'y', 'a', 'x2', 'c']->Filter() |
2172 enddef | 2180 enddef |