1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2021-06-02 16:47:53 +02:00
parent 0f37e3561d
commit c3cb1c92a3
4 changed files with 34 additions and 0 deletions

View File

@@ -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)