# HG changeset patch # User Bram Moolenaar # Date 1595531705 -7200 # Node ID 126dcb0411ed428aade0c00c73bf2fd5ebe3cda1 # Parent f0304ef8ac7de3dbc8f79fc49183bbf2fdfa4a8a patch 8.2.1286: Vim9: No error when using a type to a window variable Commit: https://github.com/vim/vim/commit/43e969d3f98766824c18d20b84f2fab00feef683 Author: Bram Moolenaar Date: Thu Jul 23 21:14:43 2020 +0200 patch 8.2.1286: Vim9: No error when using a type to a window variable Problem: Vim9: No error when using a type to a window variable Solution: Recognize the syntax and give an error. (closes https://github.com/vim/vim/issues/6521) diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3324,6 +3324,14 @@ find_ex_command( return eap->cmd; } } + + // Recognize using a type for a w:, b:, t: or g: variable: + // "w:varname: number = 123". + if (eap->cmd[1] == ':' && *p == ':') + { + eap->cmdidx = CMD_eval; + return eap->cmd; + } } #endif diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -376,6 +376,15 @@ def Test_assignment_failure() call assert_fails('s/^/\=Mess()/n', 'E794:') call CheckDefFailure(['let var: dict