# HG changeset patch # User Bram Moolenaar # Date 1668294903 -3600 # Node ID 39698292a84974c040334f4fe7189e044c7b98a6 # Parent 22b0d010c93c3f69665adb5f475042d46d149383 patch 9.0.0869: bogus error when string used after :elseif Commit: https://github.com/vim/vim/commit/28c56d501352bd98472d23667bade683877cadcc Author: Bram Moolenaar Date: Sat Nov 12 23:12:55 2022 +0000 patch 9.0.0869: bogus error when string used after :elseif Problem: Bogus error when string used after :elseif. Solution: Do not consider a double quote the start of a comment. (closes #11534) diff --git a/src/ex_eval.c b/src/ex_eval.c --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1173,7 +1173,8 @@ ex_else(exarg_T *eap) { // When skipping we ignore most errors, but a missing expression is // wrong, perhaps it should have been "else". - if (skip && ends_excmd(*eap->arg)) + // A double quote here is the start of a string, not a comment. + if (skip && *eap->arg != '"' && ends_excmd(*eap->arg)) semsg(_(e_invalid_expression_str), eap->arg); else result = eval_to_bool(eap->arg, &error, eap, skip, FALSE); diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim --- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -192,6 +192,16 @@ func Test_if_while() call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath) endfunc +" Check double quote after skipped "elseif" does not give error E15 +func Test_skipped_elseif() + if "foo" ==? "foo" + let result = "first" + elseif "foo" ==? "foo" + let result = "second" + endif + call assert_equal('first', result) +endfunc + "------------------------------------------------------------------------------- " Test 4: :return {{{1 "------------------------------------------------------------------------------- diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 869, +/**/ 868, /**/ 867,