Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 30576:72e6073a2822 v9.0.0623
patch 9.0.0623: error for modifying a const is not detected at compile time
Commit: https://github.com/vim/vim/commit/fa1039760e8c1a0c7a2a722160bd3d71a4736e61
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 29 19:14:42 2022 +0100
patch 9.0.0623: error for modifying a const is not detected at compile time
Problem: Error for modifying a const is not detected at compile time.
Solution: Add TTFLAG_CONST and check for it in add() and extend().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Sep 2022 20:15:05 +0200 |
parents | 7fc27d7ce3b0 |
children | 030bdef24446 |
comparison
equal
deleted
inserted
replaced
30575:3b314751334b | 30576:72e6073a2822 |
---|---|
2469 v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<number> but got dict<any>') | 2469 v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<number> but got dict<any>') |
2470 | 2470 |
2471 lines =<< trim END | 2471 lines =<< trim END |
2472 var l: list<dict<any>> = [{n: 1}] | 2472 var l: list<dict<any>> = [{n: 1}] |
2473 for item: dict<number> in l | 2473 for item: dict<number> in l |
2474 item->extend({s: ''}) | 2474 var d = {s: ''} |
2475 endfor | 2475 d->extend(item) |
2476 END | 2476 endfor |
2477 v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<number> but got dict<string>') | 2477 END |
2478 v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<string> but got dict<number>') | |
2478 | 2479 |
2479 lines =<< trim END | 2480 lines =<< trim END |
2480 for a in range(3) | 2481 for a in range(3) |
2481 while a > 3 | 2482 while a > 3 |
2482 for b in range(2) | 2483 for b in range(2) |