diff 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
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2207,6 +2207,15 @@ def Test_legacy_lambda()
   CheckScriptSuccess(lines)
 enddef
 
+def Test_legacy_errors()
+  for cmd in ['if', 'elseif', 'else', 'endif',
+              'for', 'endfor', 'continue', 'break',
+              'while', 'endwhile',
+              'try', 'catch', 'finally', 'endtry']
+    CheckDefFailure(['legacy ' .. cmd .. ' expr'], 'E1189:')
+  endfor
+enddef
+
 def DoFilterThis(a: string): list<string>
   # closure nested inside another closure using argument
   var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0)