diff src/testdir/test_vim9_class.vim @ 31746:d3d3ed2c09f6 v9.0.1205

patch 9.0.1205: crash when handling class that extends another class Commit: https://github.com/vim/vim/commit/ae3205aa55741152b0143dbd7d637b35f576793e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 15 20:49:00 2023 +0000 patch 9.0.1205: crash when handling class that extends another class Problem: Crash when handling class that extends another class with more than one object members. Solution: Correct pointer computations. (closes #11824)
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Jan 2023 22:00:03 +0100
parents 1b2bde0c64f2
children 13cecb002fe6
line wrap: on
line diff
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -1081,6 +1081,26 @@ def Test_class_extends()
       var c = Child.new()
   END
   v9.CheckScriptFailure(lines, 'E1325: Method not found on class "Child": new(')
+
+  # base class with more than one object member
+  lines =<< trim END
+      vim9script
+
+      class Result
+        this.success: bool
+        this.value: any = null
+      endclass
+
+      class Success extends Result
+        def new(this.value = v:none)
+          this.success = true
+        enddef
+      endclass
+
+      var v = Success.new('asdf')
+      assert_equal("object of Success {success: true, value: 'asdf'}", string(v))
+  END
+  v9.CheckScriptSuccess(lines)
 enddef
 
 def Test_class_import()