Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 20029:8fb1cf4c44d5 v8.2.0570
patch 8.2.0570: Vim9: no error when omitting type from argument
Commit: https://github.com/vim/vim/commit/6e949784be29bfaea6e49a9d8231481eae10fab6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 13 17:21:00 2020 +0200
patch 8.2.0570: Vim9: no error when omitting type from argument
Problem: Vim9: no error when omitting type from argument.
Solution: Enforce specifying argument types.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Apr 2020 17:30:05 +0200 |
parents | bf377a9ffccb |
children | 7fc5d62fe2a5 |
comparison
equal
deleted
inserted
replaced
20028:f0fb61802fe7 | 20029:8fb1cf4c44d5 |
---|---|
857 let nr = 88 | 857 let nr = 88 |
858 assert_equal(-88, -nr) | 858 assert_equal(-88, -nr) |
859 assert_equal(88, --nr) | 859 assert_equal(88, --nr) |
860 enddef | 860 enddef |
861 | 861 |
862 def Echo(arg): string | 862 def Echo(arg: any): string |
863 return arg | 863 return arg |
864 enddef | 864 enddef |
865 | 865 |
866 def s:EchoArg(arg): string | 866 def s:EchoArg(arg: any): string |
867 return arg | 867 return arg |
868 enddef | 868 enddef |
869 | 869 |
870 def Test_expr7_call() | 870 def Test_expr7_call() |
871 assert_equal('yes', 'yes'->Echo()) | 871 assert_equal('yes', 'yes'->Echo()) |
989 " dict member | 989 " dict member |
990 let d = #{key: 123} | 990 let d = #{key: 123} |
991 assert_equal(123, d.key) | 991 assert_equal(123, d.key) |
992 enddef | 992 enddef |
993 | 993 |
994 | |
994 func Test_expr7_trailing_fails() | 995 func Test_expr7_trailing_fails() |
995 call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107') | 996 call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107') |
996 call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274') | 997 call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274') |
997 endfunc | 998 endfunc |
998 | 999 |