Patch 8.2.1430
Problem:    Vim9: error for missing comma instead of extra white space.
Solution:   Check if comma can be found after white space. (closes #6668)
            Also check for extra white space in literal dict. (closes #6670)
Files:      src/list.c, src/dict.c, src/vim9compile.c,
            src/testdir/test_vim9_expr.vim


*** ../vim-8.2.1429/src/list.c  2020-07-30 22:14:29.576329749 +0200
--- src/list.c  2020-08-12 17:40:04.893688757 +0200
***************
*** 1219,1225 ****
        if (!had_comma)
        {
            if (do_error)
!               semsg(_("E696: Missing comma in List: %s"), *arg);
            goto failret;
        }
      }
--- 1219,1230 ----
        if (!had_comma)
        {
            if (do_error)
!           {
!               if (**arg == ',')
!                   semsg(_(e_no_white_before), ",");
!               else
!                   semsg(_("E696: Missing comma in List: %s"), *arg);
!           }
            goto failret;
        }
      }
*** ../vim-8.2.1429/src/dict.c  2020-08-08 15:45:58.233358630 +0200
--- src/dict.c  2020-08-12 17:47:20.887253153 +0200
***************
*** 781,787 ****
      tv->v_type = VAR_STRING;
      tv->vval.v_string = vim_strnsave(*arg, p - *arg);
  
!     *arg = skipwhite(p);
      return OK;
  }
  
--- 781,787 ----
      tv->v_type = VAR_STRING;
      tv->vval.v_string = vim_strnsave(*arg, p - *arg);
  
!     *arg = p;
      return OK;
  }
  
***************
*** 845,851 ****
        if (**arg != ':')
        {
            if (evaluate)
!               semsg(_(e_missing_dict_colon), *arg);
            clear_tv(&tvkey);
            goto failret;
        }
--- 845,856 ----
        if (**arg != ':')
        {
            if (evaluate)
!           {
!               if (*skipwhite(*arg) == ':')
!                   semsg(_(e_no_white_before), ":");
!               else
!                   semsg(_(e_missing_dict_colon), *arg);
!           }
            clear_tv(&tvkey);
            goto failret;
        }
*** ../vim-8.2.1429/src/vim9compile.c   2020-08-12 17:35:55.655082129 +0200
--- src/vim9compile.c   2020-08-12 17:53:45.549182942 +0200
***************
*** 2394,2399 ****
--- 2394,2404 ----
            semsg(_(e_list_end), *arg);
            return FAIL;
        }
+       if (*p == ',')
+       {
+           semsg(_(e_no_white_before), ",");
+           return FAIL;
+       }
        if (*p == ']')
        {
            ++p;
*** ../vim-8.2.1429/src/testdir/test_vim9_expr.vim      2020-08-12 
17:35:55.655082129 +0200
--- src/testdir/test_vim9_expr.vim      2020-08-12 17:50:11.010331676 +0200
***************
*** 1383,1389 ****
--- 1383,1392 ----
  
    call CheckDefExecFailure(["let x = g:anint[3]"], 'E714:')
    call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:')
+ 
    call CheckDefFailure(["let x = [1,2,3]"], 'E1069:')
+   call CheckDefFailure(["let x = [1 ,2, 3]"], 'E1068:')
+ 
    call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E1029:')
    call CheckDefFailure(["let x = g:list_mixed["], 'E1097:')
    call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:')
***************
*** 1422,1427 ****
--- 1425,1436 ----
        let l = [11,22]
    END
    CheckScriptFailure(lines, 'E1069:')
+ 
+   lines =<< trim END
+       vim9script
+       let l = [11 , 22]
+   END
+   CheckScriptFailure(lines, 'E1068:')
  enddef
  
  def Test_expr7_lambda()
***************
*** 1556,1561 ****
--- 1565,1582 ----
        let d = #{one: 1,two: 2}
    END
    CheckScriptFailure(lines, 'E1069:')
+ 
+   lines =<< trim END
+       vim9script
+       let d = #{one : 1}
+   END
+   CheckScriptFailure(lines, 'E1068:')
+ 
+   lines =<< trim END
+       vim9script
+       let d = #{one:1}
+   END
+   CheckScriptFailure(lines, 'E1069:')
  enddef
  
  let g:oneString = 'one'
*** ../vim-8.2.1429/src/version.c       2020-08-12 17:35:55.659082107 +0200
--- src/version.c       2020-08-12 17:41:15.673283239 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1430,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
181. You still remember the "happy tune" your modem made
     while dialing your ISP.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202008121602.07CG2MBY088791%40masaka.moolenaar.net.

Raspunde prin e-mail lui