To: vim_dev@googlegroups.com Subject: Patch 8.2.3695 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3695 Problem: Confusing error for missing key. Solution: Use the actualy key for the error. (closes #9241) Files: src/eval.c, src/testdir/test_listdict.vim *** ../vim-8.2.3694/src/eval.c 2021-11-22 20:10:14.882598756 +0000 --- src/eval.c 2021-11-29 13:40:39.753175836 +0000 *************** *** 4287,4298 **** return FAIL; } ! item = dict_find(rettv->vval.v_dict, key, (int)keylen); - if (item == NULL && verbose) - semsg(_(e_dictkey), key); if (item == NULL) return FAIL; copy_tv(&item->di_tv, &tmp); clear_tv(rettv); --- 4287,4304 ---- return FAIL; } ! item = dict_find(rettv->vval.v_dict, key, keylen); if (item == NULL) + { + if (verbose) + { + if (keylen > 0) + key[keylen] = NUL; + semsg(_(e_dictkey), key); + } return FAIL; + } copy_tv(&item->di_tv, &tmp); clear_tv(rettv); *** ../vim-8.2.3694/src/testdir/test_listdict.vim 2021-08-13 17:19:54.678450486 +0100 --- src/testdir/test_listdict.vim 2021-11-29 13:34:03.089414111 +0000 *************** *** 455,460 **** --- 455,479 ---- call CheckLegacyAndVim9Failure(lines, 'E716:') let lines =<< trim END + let d = {'a-b': 55} + echo d.a-b + END + call CheckScriptFailure(lines, 'E716: Key not present in Dictionary: "a"') + + let lines =<< trim END + vim9script + var d = {'a-b': 55} + echo d.a-b + END + call CheckScriptFailure(lines, 'E716: Key not present in Dictionary: "a"') + + let lines =<< trim END + var d = {'a-b': 55} + echo d.a-b + END + call CheckDefFailure(lines, 'E1004: White space required before and after ''-''') + + let lines =<< trim END let d = {1: 'a', 3: 'c'} call remove(d, []) END *** ../vim-8.2.3694/src/version.c 2021-11-29 12:12:38.175653429 +0000 --- src/version.c 2021-11-29 13:34:23.965406379 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3695, /**/ -- ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot. King of all Britons, defeator of the Saxons, sovereign of all England! [Pause] SOLDIER: Get away! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///