On Di, 04 Dez 2018, Bram Moolenaar wrote:
>
> Patch 8.1.0563
> Problem: Setting v:errors to a string give confusing error. (Christian
> Brabandt)
> Solution: Change internal error into normal error message.
> Files: src/eval.c
Thanks, but that fixes only half the problem. Vim will still set the
variable to the new type, e.g. after E963 v:errors is now a string variable.
How about to put this on top of it (this includes the test from
Dominique, [see #3662] with slight changes):
diff --git a/src/eval.c b/src/eval.c
index 1dae2bfba..8839e0572 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7568,7 +7568,10 @@ set_var(
return;
}
else if (v->di_tv.v_type != tv->v_type)
+ {
EMSG2(_("E963: setting %s to value with wrong type"), name);
+ return;
+ }
}
clear_tv(&v->di_tv);
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index bcf45cc78..a1aa78878 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -53,3 +53,13 @@ func Test_line_continuation()
"\ and some more
call assert_equal([5, 6], array)
endfunc
+
+func Test_E963()
+ " These commands used to cause an internal error prior to vim 8.1.0563
+ let v_e = v:errors
+ let v_o = v:oldfiles
+ call assert_fails("let v:errors=''", 'E963:')
+ call assert_equal(v_e, v:errors)
+ call assert_fails("let v:oldfiles=''", 'E963:')
+ call assert_equal(v_o, v:oldfiles)
+endfunc
Mit freundlichen Grüßen
Christian
--
Je weicher die Wahrheit, desto steifer der Standpunkt.
-- Stanislaw Jerzy Lec (eig. S. J. de Tusch-Letz)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.