patch 9.1.1099: Vim9: import with extends may crash

Commit: 
https://github.com/vim/vim/commit/54d7f18c3882bfa2b1c4294a862007feb9b6a382
Author: Yegappan Lakshmanan <yegap...@yahoo.com>
Date:   Mon Feb 10 21:35:07 2025 +0100

    patch 9.1.1099: Vim9: import with extends may crash
    
    Problem:  Vim9: import with extends may crash, v9.1.1087 wasn't the
              correct way to fix it)
    Solution: When using an import class, Check for a valid class member
              variable at compile time (Yegappan Lakshmanan)
    
    related: #16601
    closes: #16603
    
    Signed-off-by: Yegappan Lakshmanan <yegap...@yahoo.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 4c7a27303..680d1a121 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -96,7 +96,7 @@ clean:
        -rm -f opt_test.vim test_result.log $(CLEANUP_FILES)
        -rm -rf $(RM_ON_RUN) $(RM_ON_START)
        -rm -f valgrind.*
-       -rm -f asan.*
+       -rm -f asan.* asan_test_*
        -rm -f guidialog guidialogfile
 
 # Delete the files produced by benchmarking, so they can run again.
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index c8dfa1e73..5f5c928b6 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -3454,8 +3454,7 @@ def Test_vim9_import_and_class_extends()
     var myView = View.new('This should be ok')
     assert_equal('This should be ok', myView.content.value)
   END
-  # TODO: The root cause will be identified later.
-  v9.CheckScriptFailure(lines, 'E1099: Unknown error while executing new', 7)
+  v9.CheckScriptFailure(lines, 'E1376: Object variable "value2" accessible 
only using class "Run" object', 2)
 enddef
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/version.c b/src/version.c
index 12cdfce5f..f72f817e1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1099,
 /**/
     1098,
 /**/
diff --git a/src/vim9compile.c b/src/vim9compile.c
index aa3e17ef6..be26c9bad 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2496,9 +2496,10 @@ compile_load_lhs(
        lhs->lhs_type = cctx->ctx_type_stack.ga_len == 0 ? &t_void
                                                  : get_type_on_stack(cctx, 0);
 
-       if (lhs->lhs_type->tt_type == VAR_OBJECT)
+       if (lhs->lhs_type->tt_type == VAR_CLASS
+               || lhs->lhs_type->tt_type == VAR_OBJECT)
        {
-           // Check whether the object variable is modifiable
+           // Check whether the class or object variable is modifiable
            if (!lhs_class_member_modifiable(lhs, var_start, cctx))
                return FAIL;
        }
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 50220006b..c7f0e673b 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2461,14 +2461,8 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
                otv = class->class_members_tv;
            }
 
-           if (otv != NULL)
-           {
-               clear_tv(&otv[lidx]);
-               otv[lidx] = *tv;
-           }
-           else
-               status = FAIL;
-
+           clear_tv(&otv[lidx]);
+           otv[lidx] = *tv;
        }
        else
        {

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1thaeN-001ITm-1S%40256bit.org.

Raspunde prin e-mail lui