Patch 8.2.3868 (after 8.2.3866)
Problem:    Vim9: function test fails.
Solution:   Add missing changes.  Add test for earlier patch.
Files:      src/vim9type.c, src/testdir/test_vim9_disassemble.vim


*** ../vim-8.2.3867/src/vim9type.c      2021-12-18 12:31:30.615693410 +0000
--- src/vim9type.c      2021-12-21 11:37:37.056992930 +0000
***************
*** 567,573 ****
--- 567,575 ----
      {
        // tt_type should match, except that a "partial" can be assigned to a
        // variable with type "func".
+       // And "unknown" (using global variable) needs a runtime type check.
        if (!(expected->tt_type == actual->tt_type
+                   || actual->tt_type == VAR_UNKNOWN
                    || (expected->tt_type == VAR_FUNC
                                           && actual->tt_type == VAR_PARTIAL)))
        {
***************
*** 582,588 ****
        if (expected->tt_type == VAR_DICT || expected->tt_type == VAR_LIST)
        {
            // "unknown" is used for an empty list or dict
!           if (actual->tt_member != &t_unknown)
                ret = check_type(expected->tt_member, actual->tt_member,
                                                                 FALSE, where);
        }
--- 584,590 ----
        if (expected->tt_type == VAR_DICT || expected->tt_type == VAR_LIST)
        {
            // "unknown" is used for an empty list or dict
!           if (actual->tt_member != NULL && actual->tt_member != &t_unknown)
                ret = check_type(expected->tt_member, actual->tt_member,
                                                                 FALSE, where);
        }
***************
*** 592,598 ****
            // nothing, thus there is no point in checking.
            if (expected->tt_member != &t_unknown)
            {
!               if (actual->tt_member != &t_unknown)
                    ret = check_type(expected->tt_member, actual->tt_member,
                                                                 FALSE, where);
                else
--- 594,601 ----
            // nothing, thus there is no point in checking.
            if (expected->tt_member != &t_unknown)
            {
!               if (actual->tt_member != NULL
!                                           && actual->tt_member != &t_unknown)
                    ret = check_type(expected->tt_member, actual->tt_member,
                                                                 FALSE, where);
                else
*** ../vim-8.2.3867/src/testdir/test_vim9_disassemble.vim       2021-12-16 
15:49:39.157345806 +0000
--- src/testdir/test_vim9_disassemble.vim       2021-12-20 12:01:45.626213368 
+0000
***************
*** 2328,2354 ****
    elseif false
      echo "false"
    endif
  enddef
  
  def Test_debug_elseif_constant()
!   var res = execute('disass s:ElseifConstant')
    assert_match('<SNR>\d*_ElseifConstant\_s*' ..
            'if g:value\_s*' ..
!           '0 LOADG g:value\_s*' ..
!           '1 COND2BOOL\_s*' ..
!           '2 JUMP_IF_FALSE -> 6\_s*' ..
            'echo "one"\_s*' ..
!           '3 PUSHS "one"\_s*' ..
!           '4 ECHO 1\_s*' ..
            'elseif true\_s*' ..
!           '5 JUMP -> 8\_s*' ..
            'echo "true"\_s*' ..
!           '6 PUSHS "true"\_s*' ..
!           '7 ECHO 1\_s*' ..
            'elseif false\_s*' ..
            'echo "false"\_s*' ..
            'endif\_s*' ..
!           '\d RETURN void*',
          res)
  enddef
  
--- 2328,2370 ----
    elseif false
      echo "false"
    endif
+   if 0
+     echo "yes"
+   elseif 0
+     echo "no"
+   endif
  enddef
  
  def Test_debug_elseif_constant()
!   var res = execute('disass debug s:ElseifConstant')
    assert_match('<SNR>\d*_ElseifConstant\_s*' ..
            'if g:value\_s*' ..
!           '0 DEBUG line 1-1 varcount 0\_s*' ..
!           '1 LOADG g:value\_s*' ..
!           '2 COND2BOOL\_s*' ..
!           '3 JUMP_IF_FALSE -> 8\_s*' ..
            'echo "one"\_s*' ..
!           '4 DEBUG line 2-2 varcount 0\_s*' ..
!           '5 PUSHS "one"\_s*' ..
!           '6 ECHO 1\_s*' ..
            'elseif true\_s*' ..
!           '7 JUMP -> 12\_s*' ..
!           '8 DEBUG line 3-3 varcount 0\_s*' ..
            'echo "true"\_s*' ..
!           '9 DEBUG line 4-4 varcount 0\_s*' ..
!           '10 PUSHS "true"\_s*' ..
!           '11 ECHO 1\_s*' ..
            'elseif false\_s*' ..
            'echo "false"\_s*' ..
            'endif\_s*' ..
!           'if 0\_s*' ..
!           '12 DEBUG line 8-8 varcount 0\_s*' ..
!           'echo "yes"\_s*' ..
!           'elseif 0\_s*' ..
!           '13 DEBUG line 11-10 varcount 0\_s*' ..
!           'echo "no"\_s*' ..
!           'endif\_s*' ..
!           '14 RETURN void*',
          res)
  enddef
  
*** ../vim-8.2.3867/src/version.c       2021-12-21 13:19:38.745205784 +0000
--- src/version.c       2021-12-21 13:30:23.128867688 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3868,
  /**/

-- 
In order for something to become clean, something else must become dirty;
but you can get everything dirty without getting anything clean.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20211221133200.591301C0F5C%40moolenaar.net.

Raspunde prin e-mail lui