patch 9.0.1091: assignment to non-existing member causes a crash

Problem:    Assignment to non-existing member causes a crash. (Yegappan
            Lakshmanan)
Solution:   Give an error message and bail out when a member cannot be found.
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index f45e3fa..88128e7 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -111,6 +111,17 @@
   lines =<< trim END
       vim9script
       class Something
+        def new()
+          this.state = 0
+        enddef
+      endclass
+      var obj = Something.new()
+  END
+  v9.CheckScriptFailure(lines, 'E1089:')
+
+  lines =<< trim END
+      vim9script
+      class Something
         this.count : number
       endclass
   END
@@ -330,7 +341,9 @@
       assert_equal(0, TextPos.counter)
       TextPos.AddToCounter(3)
       assert_equal(3, TextPos.counter)
+      assert_fails('echo TextPos.noSuchMember', 'E1338:')
 
+      assert_fails('TextPos.noSuchMember = 2', 'E1337:')
       assert_fails('TextPos.counter += 5', 'E1335')
   END
   v9.CheckScriptSuccess(lines)
diff --git a/src/version.c b/src/version.c
index d07e657..5679588 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1091,
+/**/
     1090,
 /**/
     1089,
diff --git a/src/vim9class.c b/src/vim9class.c
index 94fe9e2..2e1cac0 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -569,8 +569,9 @@
 }
 
 /*
- * Find member "name" in class "cl" and return its type.
- * When not found t_any is returned.
+ * Find member "name" in class "cl", set "member_idx" to the member index and
+ * return its type.
+ * When not found "member_idx" is set to -1 and t_any is returned.
  */
     type_T *
 class_member_type(
@@ -591,6 +592,8 @@
 	    return m->ocm_type;
 	}
     }
+
+    semsg(_(e_unknown_variable_str), name);
     return &t_any;
 }
 
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 44403ec..9105dcf 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1823,6 +1823,8 @@
 	    class_T *cl = (class_T *)lhs->lhs_type->tt_member;
 	    lhs->lhs_member_type = class_member_type(cl, after + 1,
 					   lhs->lhs_end, &lhs->lhs_member_idx);
+	    if (lhs->lhs_member_idx < 0)
+		return FAIL;
 	}
 	else
 	    lhs->lhs_member_type = lhs->lhs_type->tt_member;