diff src/testdir/test_vim9_assign.vim @ 25547:ec4df0b982da v8.2.3310

patch 8.2.3310: Vim9: unpack assignment does not mention source of type error Commit: https://github.com/vim/vim/commit/4270d8b7626ff8a7006f6a09c89bc446a3f89d1e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 7 16:30:42 2021 +0200 patch 8.2.3310: Vim9: unpack assignment does not mention source of type error Problem: Vim9: unpack assignment does not mention source of type error. Solution: Mention the argument number. (closes https://github.com/vim/vim/issues/8719)
author Bram Moolenaar <Bram@vim.org>
date Sat, 07 Aug 2021 16:45:03 +0200
parents f7db86111acd
children ea69398b40d1
line wrap: on
line diff
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -414,6 +414,22 @@ def Test_assign_unpack()
     [x, y] = g:values
   END
   CheckDefExecAndScriptFailure(lines, 'E1163: Variable 2: type mismatch, expected string but got number')
+
+  lines =<< trim END
+    var x: number
+    var y: number
+    var z: string
+    [x, y, z] = [1, 2, 3]
+  END
+  CheckDefAndScriptFailure(lines, 'E1163: Variable 3: type mismatch, expected string but got number')
+
+  lines =<< trim END
+    var x: number
+    var y: string
+    var z: string
+    [x, y, z] = [1, '2', 3]
+  END
+  CheckDefExecAndScriptFailure(lines, 'E1163: Variable 3: type mismatch, expected string but got number')
 enddef
 
 def Test_assign_linebreak()