Patch 8.2.0318
Problem:    Vim9: types not sufficiently tested.
Solution:   Add tests with more types.
Files:      src/globals.h, src/vim9compile.c,
            src/testdir/test_vim9_script.vim, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.0317/src/globals.h       2020-02-20 22:54:39.609505358 +0100
--- src/globals.h       2020-02-25 22:45:11.827117028 +0100
***************
*** 403,412 ****
--- 403,414 ----
  EXTERN type_T t_list_empty INIT4(VAR_LIST, 0, &t_void, NULL);
  EXTERN type_T t_dict_empty INIT4(VAR_DICT, 0, &t_void, NULL);
  
+ EXTERN type_T t_list_bool INIT4(VAR_LIST, 0, &t_bool, NULL);
  EXTERN type_T t_list_number INIT4(VAR_LIST, 0, &t_number, NULL);
  EXTERN type_T t_list_string INIT4(VAR_LIST, 0, &t_string, NULL);
  EXTERN type_T t_list_dict_any INIT4(VAR_LIST, 0, &t_dict_any, NULL);
  
+ EXTERN type_T t_dict_bool INIT4(VAR_DICT, 0, &t_bool, NULL);
  EXTERN type_T t_dict_number INIT4(VAR_DICT, 0, &t_number, NULL);
  EXTERN type_T t_dict_string INIT4(VAR_DICT, 0, &t_string, NULL);
  
*** ../vim-8.2.0317/src/vim9compile.c   2020-02-23 21:25:50.464675047 +0100
--- src/vim9compile.c   2020-02-25 22:48:15.822319104 +0100
***************
*** 213,218 ****
--- 213,220 ----
        return &t_list_any;
      if (member_type->tt_type == VAR_VOID)
        return &t_list_empty;
+     if (member_type->tt_type == VAR_BOOL)
+       return &t_list_bool;
      if (member_type->tt_type == VAR_NUMBER)
        return &t_list_number;
      if (member_type->tt_type == VAR_STRING)
***************
*** 238,243 ****
--- 240,247 ----
        return &t_dict_any;
      if (member_type->tt_type == VAR_VOID)
        return &t_dict_empty;
+     if (member_type->tt_type == VAR_BOOL)
+       return &t_dict_bool;
      if (member_type->tt_type == VAR_NUMBER)
        return &t_dict_number;
      if (member_type->tt_type == VAR_STRING)
*** ../vim-8.2.0317/src/testdir/test_vim9_script.vim    2020-02-23 
22:35:01.155497764 +0100
--- src/testdir/test_vim9_script.vim    2020-02-25 22:48:57.802141814 +0100
***************
*** 37,50 ****
    let bool2: bool = false
    assert_equal(v:false, bool2)
  
!   let list1: list<string> = ['sdf', 'asdf']
    let list2: list<number> = [1, 2, 3]
  
    let listS: list<string> = []
    let listN: list<number> = []
  
!   let dict1: dict<string> = #{key: 'value'}
    let dict2: dict<number> = #{one: 1, two: 2}
  
    g:newvar = 'new'
    assert_equal('new', g:newvar)
--- 37,56 ----
    let bool2: bool = false
    assert_equal(v:false, bool2)
  
!   let list1: list<bool> = [false, true, false]
    let list2: list<number> = [1, 2, 3]
+   let list3: list<string> = ['sdf', 'asdf']
+   let list4: list<any> = ['yes', true, 1234]
+   let list5: list<blob> = [0z01, 0z02]
  
    let listS: list<string> = []
    let listN: list<number> = []
  
!   let dict1: dict<bool> = #{one: false, two: true}
    let dict2: dict<number> = #{one: 1, two: 2}
+   let dict3: dict<string> = #{key: 'value'}
+   let dict4: dict<any> = #{one: 1, two: '2'}
+   let dict5: dict<blob> = #{one: 0z01, tw: 0z02}
  
    g:newvar = 'new'
    assert_equal('new', g:newvar)
*** ../vim-8.2.0317/src/testdir/test_vim9_expr.vim      2020-02-22 
20:33:05.492008174 +0100
--- src/testdir/test_vim9_expr.vim      2020-02-25 22:56:09.376387740 +0100
***************
*** 861,864 ****
--- 861,868 ----
    call CheckDefExecFailure("CallMe ('yes')", 'E492:')
    call CheckDefFailure("CallMe2('yes','no')", 'E1069:')
    call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:')
+ 
+   call CheckDefFailure("v:nosuch += 3", 'E1001:')
+   call CheckDefFailure("let v:version = 3", 'E1064:')
+   call CheckDefFailure("let asdf = v:nosuch", 'E1001:')
  endfunc
*** ../vim-8.2.0317/src/version.c       2020-02-25 22:04:51.947847962 +0100
--- src/version.c       2020-02-25 22:44:57.763179682 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     318,
  /**/

-- 
An actual excerpt from a classified section of a city newspaper:
"Illiterate?  Write today for free help!"

 /// 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/202002252158.01PLwuOb026420%40masaka.moolenaar.net.

Raspunde prin e-mail lui