Patch 8.2.0465
Problem:    Vim9: dead code and wrong return type.
Solution:   Remove dead code.  Fix return type.  Add more tests.
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0464/src/vim9compile.c   2020-03-26 13:15:38.578501310 +0100
--- src/vim9compile.c   2020-03-28 14:50:41.608907329 +0100
***************
*** 242,248 ****
  
      // Not a common type, create a new entry.
      if (ga_grow(type_list, 1) == FAIL)
!       return FAIL;
      type = ((type_T *)type_list->ga_data) + type_list->ga_len;
      ++type_list->ga_len;
      type->tt_type = VAR_LIST;
--- 242,248 ----
  
      // Not a common type, create a new entry.
      if (ga_grow(type_list, 1) == FAIL)
!       return &t_any;
      type = ((type_T *)type_list->ga_data) + type_list->ga_len;
      ++type_list->ga_len;
      type->tt_type = VAR_LIST;
***************
*** 269,275 ****
  
      // Not a common type, create a new entry.
      if (ga_grow(type_list, 1) == FAIL)
!       return FAIL;
      type = ((type_T *)type_list->ga_data) + type_list->ga_len;
      ++type_list->ga_len;
      type->tt_type = VAR_DICT;
--- 269,275 ----
  
      // Not a common type, create a new entry.
      if (ga_grow(type_list, 1) == FAIL)
!       return &t_any;
      type = ((type_T *)type_list->ga_data) + type_list->ga_len;
      ++type_list->ga_len;
      type->tt_type = VAR_DICT;
***************
*** 1368,1373 ****
--- 1368,1374 ----
  parse_type_member(char_u **arg, type_T *type, garray_T *type_list)
  {
      type_T  *member_type;
+     int           prev_called_emsg = called_emsg;
  
      if (**arg != '<')
      {
***************
*** 1380,1390 ****
      *arg = skipwhite(*arg + 1);
  
      member_type = parse_type(arg, type_list);
-     if (member_type == NULL)
-       return type;
  
      *arg = skipwhite(*arg);
!     if (**arg != '>')
      {
        emsg(_("E1009: Missing > after type"));
        return type;
--- 1381,1389 ----
      *arg = skipwhite(*arg + 1);
  
      member_type = parse_type(arg, type_list);
  
      *arg = skipwhite(*arg);
!     if (**arg != '>' && called_emsg == prev_called_emsg)
      {
        emsg(_("E1009: Missing > after type"));
        return type;
***************
*** 1766,1771 ****
--- 1765,1775 ----
                return FAIL;
            }
            ++p;
+           if (VIM_ISWHITE(*p))
+           {
+               emsg(_("E1074: no white space allowed after dot"));
+               return FAIL;
+           }
  
            idx = find_exported(import->imp_sid, &p, &name_len, &ufunc, &type);
            // TODO: what if it is a function?
***************
*** 1806,1811 ****
--- 1810,1816 ----
      char_u    *name;
      char_u    *end = end_arg;
      int               res = FAIL;
+     int               prev_called_emsg = called_emsg;
  
      if (*(*arg + 1) == ':')
      {
***************
*** 1892,1898 ****
      *arg = end;
  
  theend:
!     if (res == FAIL && error)
        semsg(_(e_var_notfound), name);
      vim_free(name);
      return res;
--- 1897,1903 ----
      *arg = end;
  
  theend:
!     if (res == FAIL && error && called_emsg == prev_called_emsg)
        semsg(_(e_var_notfound), name);
      vim_free(name);
      return res;
*** ../vim-8.2.0464/src/testdir/test_vim9_script.vim    2020-03-26 
14:11:52.903001238 +0100
--- src/testdir/test_vim9_script.vim    2020-03-28 14:52:01.192656713 +0100
***************
*** 112,117 ****
--- 112,127 ----
  
    call CheckDefFailure(['let var: dict <number>'], 'E1007:')
    call CheckDefFailure(['let var: dict<number'], 'E1009:')
+ endfunc
+ 
+ func Test_wrong_type()
+   call CheckDefFailure(['let var: list<nothing>'], 'E1010:')
+   call CheckDefFailure(['let var: list<list<nothing>>'], 'E1010:')
+   call CheckDefFailure(['let var: dict<nothing>'], 'E1010:')
+   call CheckDefFailure(['let var: dict<dict<nothing>>'], 'E1010:')
+ 
+   call CheckDefFailure(['let var: dict<number'], 'E1009:')
+   call CheckDefFailure(['let var: dict<list<number>'], 'E1009:')
  
    call CheckDefFailure(['let var: ally'], 'E1010:')
    call CheckDefFailure(['let var: bram'], 'E1010:')
***************
*** 436,441 ****
--- 446,482 ----
    source Ximport.vim
    assert_equal(9883, g:imported)
  
+   let import_star_as_lines_no_dot =<< trim END
+     vim9script
+     import * as Export from './Xexport.vim'
+     def Func()
+       let dummy = 1
+       let imported = Export + dummy
+     enddef
+   END
+   writefile(import_star_as_lines_no_dot, 'Ximport.vim')
+   assert_fails('source Ximport.vim', 'E1060:')
+ 
+   let import_star_as_lines_dot_space =<< trim END
+     vim9script
+     import * as Export from './Xexport.vim'
+     def Func()
+       let imported = Export . exported
+     enddef
+   END
+   writefile(import_star_as_lines_dot_space, 'Ximport.vim')
+   assert_fails('source Ximport.vim', 'E1074:')
+ 
+   let import_star_as_lines_missing_name =<< trim END
+     vim9script
+     import * as Export from './Xexport.vim'
+     def Func()
+       let imported = Export.
+     enddef
+   END
+   writefile(import_star_as_lines_missing_name, 'Ximport.vim')
+   assert_fails('source Ximport.vim', 'E1048:')
+ 
    let import_star_lines =<< trim END
      vim9script
      import * from './Xexport.vim'
*** ../vim-8.2.0464/src/version.c       2020-03-27 20:58:33.345005916 +0100
--- src/version.c       2020-03-28 14:52:43.596524301 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     465,
  /**/

-- 
Advice to worms:  Sleep late.

 /// 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/202003281353.02SDrn8J017730%40masaka.moolenaar.net.

Raspunde prin e-mail lui