Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 22910:f78057703df9 v8.2.2002
patch 8.2.2002: Vim9: lambda argument shadowed by function name
Commit: https://github.com/vim/vim/commit/52bf81c2d5f0d57443a29525b68b88707f5ad87c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 17 18:50:44 2020 +0100
patch 8.2.2002: Vim9: lambda argument shadowed by function name
Problem: Vim9: lambda argument shadowed by function name.
Solution: Let function name be shadowed by lambda argument. (closes https://github.com/vim/vim/issues/7313)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Nov 2020 19:00:04 +0100 |
parents | 54219df706b5 |
children | 00b0275ffe7f |
comparison
equal
deleted
inserted
replaced
22909:3bd8aeb73f94 | 22910:f78057703df9 |
---|---|
1454 Func() | 1454 Func() |
1455 END | 1455 END |
1456 CheckScriptSuccess(lines) | 1456 CheckScriptSuccess(lines) |
1457 enddef | 1457 enddef |
1458 | 1458 |
1459 def Shadowed(): list<number> | |
1460 var FuncList: list<func: number> = [{ -> 42}] | |
1461 return FuncList->map({_, Shadowed -> Shadowed()}) | |
1462 enddef | |
1463 | |
1464 def Test_lambda_arg_shadows_func() | |
1465 assert_equal([42], Shadowed()) | |
1466 enddef | |
1467 | |
1459 def Line_continuation_in_def(dir: string = ''): string | 1468 def Line_continuation_in_def(dir: string = ''): string |
1460 var path: string = empty(dir) | 1469 var path: string = empty(dir) |
1461 \ ? 'empty' | 1470 \ ? 'empty' |
1462 \ : 'full' | 1471 \ : 'full' |
1463 return path | 1472 return path |