comparison src/testdir/test_vim9_expr.vim @ 23561:647ff61c0bcd v8.2.2323

patch 8.2.2323: Vim9: error when inferring type from empty dict/list Commit: https://github.com/vim/vim/commit/31a11b942a56bf75a653eec0976f365f9b389a5a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 10 19:23:27 2021 +0100 patch 8.2.2323: Vim9: error when inferring type from empty dict/list Problem: Vim9: error when inferring type from empty dict/list. Solution: When the member is t_unknown use t_any. (closes https://github.com/vim/vim/issues/7009)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Jan 2021 19:30:04 +0100
parents 0f7bb6f706f0
children 34aa2907082a
comparison
equal deleted inserted replaced
23560:8d06e0d19894 23561:647ff61c0bcd
2927 CheckDefAndScriptSuccess(lines) 2927 CheckDefAndScriptSuccess(lines)
2928 2928
2929 lines = ['var l = [0, 1, 2]', 'echo l[g:astring : g:theone]'] 2929 lines = ['var l = [0, 1, 2]', 'echo l[g:astring : g:theone]']
2930 CheckDefExecFailure(lines, 'E1012:') 2930 CheckDefExecFailure(lines, 'E1012:')
2931 CheckScriptFailure(['vim9script'] + lines, 'E1030:', 3) 2931 CheckScriptFailure(['vim9script'] + lines, 'E1030:', 3)
2932
2933 lines =<< trim END
2934 vim9script
2935 var ld = []
2936 def Func()
2937 eval ld[0].key
2938 enddef
2939 defcompile
2940 END
2941 CheckScriptSuccess(lines)
2932 enddef 2942 enddef
2933 2943
2934 def Test_expr7_dict_subscript() 2944 def Test_expr7_dict_subscript()
2935 var lines =<< trim END 2945 var lines =<< trim END
2936 vim9script 2946 vim9script
2937 var l = [{lnum: 2}, {lnum: 1}] 2947 var l = [{lnum: 2}, {lnum: 1}]
2938 var res = l[0].lnum > l[1].lnum 2948 var res = l[0].lnum > l[1].lnum
2939 assert_true(res) 2949 assert_true(res)
2950
2951 var dd = {}
2952 def Func1()
2953 eval dd.key1.key2
2954 enddef
2955 def Func2()
2956 eval dd['key1'].key2
2957 enddef
2958 defcompile
2940 END 2959 END
2941 CheckScriptSuccess(lines) 2960 CheckScriptSuccess(lines)
2942 enddef 2961 enddef
2943 2962
2944 def Test_expr7_subscript_linebreak() 2963 def Test_expr7_subscript_linebreak()