comparison src/testdir/test_vim9_func.vim @ 21174:95abb4b22905 v8.2.1138

patch 8.2.1138: Vim9: return type of copy() and deepcopy() is any Commit: https://github.com/vim/vim/commit/a66ba01a5fbbd72375ef6982b901d6552da2414f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 5 18:41:08 2020 +0200 patch 8.2.1138: Vim9: return type of copy() and deepcopy() is any Problem: Vim9: return type of copy() and deepcopy() is any. Solution: Use type of the argument.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jul 2020 18:45:04 +0200
parents 96ae8622cfb6
children 54c665ad2db3
comparison
equal deleted inserted replaced
21173:664223de3ed4 21174:95abb4b22905
891 891
892 let d = getloclist(1, #{items: 0}) 892 let d = getloclist(1, #{items: 0})
893 assert_equal(#{items: []}, d) 893 assert_equal(#{items: []}, d)
894 enddef 894 enddef
895 895
896 def Test_copy_return_type()
897 let l = copy([1, 2, 3])
898 let res = 0
899 for n in l
900 res += n
901 endfor
902 assert_equal(6, res)
903
904 let dl = deepcopy([1, 2, 3])
905 res = 0
906 for n in dl
907 res += n
908 endfor
909 assert_equal(6, res)
910 enddef
911
896 def Line_continuation_in_def(dir: string = ''): string 912 def Line_continuation_in_def(dir: string = ''): string
897 let path: string = empty(dir) 913 let path: string = empty(dir)
898 \ ? 'empty' 914 \ ? 'empty'
899 \ : 'full' 915 \ : 'full'
900 return path 916 return path