comparison src/testdir/test_vim9_func.vim @ 24776:7464d4c927f5 v8.2.2926

patch 8.2.2926: Vim9: no good error for using :legacy in a :def function Commit: https://github.com/vim/vim/commit/c3cb1c92a335be818971acd89f631e82aa30ad3f Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 2 16:47:53 2021 +0200 patch 8.2.2926: Vim9: no good error for using :legacy in a :def function Problem: Vim9: no good error for using :legacy in a :def function. Solution: Give an explicit error where :legacy is not working. (closes #8309)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Jun 2021 17:00:04 +0200
parents 13efbfc53054
children a8d64f1a223b
comparison
equal deleted inserted replaced
24775:f3e925a22651 24776:7464d4c927f5
2205 legacy call s:Func() 2205 legacy call s:Func()
2206 END 2206 END
2207 CheckScriptSuccess(lines) 2207 CheckScriptSuccess(lines)
2208 enddef 2208 enddef
2209 2209
2210 def Test_legacy_errors()
2211 for cmd in ['if', 'elseif', 'else', 'endif',
2212 'for', 'endfor', 'continue', 'break',
2213 'while', 'endwhile',
2214 'try', 'catch', 'finally', 'endtry']
2215 CheckDefFailure(['legacy ' .. cmd .. ' expr'], 'E1189:')
2216 endfor
2217 enddef
2218
2210 def DoFilterThis(a: string): list<string> 2219 def DoFilterThis(a: string): list<string>
2211 # closure nested inside another closure using argument 2220 # closure nested inside another closure using argument
2212 var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0) 2221 var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0)
2213 return ['x', 'y', 'a', 'x2', 'c']->Filter() 2222 return ['x', 'y', 'a', 'x2', 'c']->Filter()
2214 enddef 2223 enddef