Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 23531:f39a18a42aed v8.2.2308
patch 8.2.2308: Vim9: no error when assigning lambda to funcref
Commit: https://github.com/vim/vim/commit/328eac2b5d1569c57e1130ecb9f7cca733b84d78
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 7 19:23:08 2021 +0100
patch 8.2.2308: Vim9: no error when assigning lambda to funcref
Problem: Vim9: no error when assigning lambda to funcref without return
value.
Solution: Default return value to "any". (closes #7629)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 07 Jan 2021 19:30:06 +0100 |
parents | b0a6e7325169 |
children | 7f0fc2ab90e3 |
comparison
equal
deleted
inserted
replaced
23530:47d509a28915 | 23531:f39a18a42aed |
---|---|
1089 assert_equal(123, FuncRef_Func()) | 1089 assert_equal(123, FuncRef_Func()) |
1090 var FuncRef_Any: any = () => 123 | 1090 var FuncRef_Any: any = () => 123 |
1091 assert_equal(123, FuncRef_Any()) | 1091 assert_equal(123, FuncRef_Any()) |
1092 END | 1092 END |
1093 CheckScriptSuccess(lines) | 1093 CheckScriptSuccess(lines) |
1094 | |
1095 lines =<< trim END | |
1096 var Ref: func(number) | |
1097 Ref = (j) => !j | |
1098 END | |
1099 CheckDefFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(any): bool') | |
1100 CheckScriptFailure(['vim9script'] + lines, 'E1012: Type mismatch; expected func(number) but got func(any): any') | |
1094 enddef | 1101 enddef |
1095 | 1102 |
1096 def Test_heredoc() | 1103 def Test_heredoc() |
1097 var lines =<< trim END # comment | 1104 var lines =<< trim END # comment |
1098 text | 1105 text |