]> granicus.if.org Git - vim/commitdiff
patch 8.2.1101: no error when using wrong arguments for setqflist() v8.2.1101
authorBram Moolenaar <Bram@vim.org>
Tue, 30 Jun 2020 20:11:44 +0000 (22:11 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 30 Jun 2020 20:11:44 +0000 (22:11 +0200)
Problem:    No error when using wrong arguments for setqflist() or
            setloclist().
Solution:   Check for the error.

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 3bd0f75e245e1b98b3143be69f80b4d08d7d3388..091246b764100844fa28a34d882d778378fb8ad7 100644 (file)
@@ -7400,6 +7400,14 @@ set_errorlist(
        return OK;
     }
 
+    // A dict argument cannot be specified with a non-empty list argument
+    if (list != NULL && list->lv_len != 0 && what != NULL)
+    {
+       semsg(_(e_invarg2),
+                        _("cannot have both a list and a \"what\" argument"));
+       return FAIL;
+    }
+
     incr_quickfix_busy();
 
     if (what != NULL)
index 608a9553b8c80a611e83409adde2994c784d9325..6d119fe3e39fa5fee044f717a1214f9ff257f68c 100644 (file)
@@ -2360,6 +2360,9 @@ func Xproperty_tests(cchar)
     call assert_equal(['Colors'], newl2.context)
     call assert_equal('Line10', newl2.items[0].text)
     call g:Xsetlist([], 'f')
+
+    " Cannot specify both a non-empty list argument and a dict argument
+    call assert_fails("call g:Xsetlist([{}], ' ', {})", 'E475:')
 endfunc
 
 func Test_qf_property()
index 9da21730d2ea859efb3bf0dd994ad9faaf252608..f1b0be6f690d028edcc0ae8fbdc3461e067f5272 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1101,
 /**/
     1100,
 /**/