Mercurial > vim
comparison src/testdir/test_vim9_class.vim @ 33337:19b4f85c2649 v9.0.1932
patch 9.0.1932: Vim9: error when using null object constructor
Commit: https://github.com/vim/vim/commit/7398f367d5125eedfb4058c63a5d167fe8601e3d
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Sep 24 23:09:10 2023 +0200
patch 9.0.1932: Vim9: error when using null object constructor
Problem: Vim9: error when using null object constructor
Solution: Check for a null object only when calling an object method
closes: #13154
closes: #13163
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Sep 2023 23:15:07 +0200 |
parents | 4e531adb3fac |
children | 41b50abddeea |
comparison
equal
deleted
inserted
replaced
33336:4541997c3638 | 33337:19b4f85c2649 |
---|---|
5673 assert_equal(4, ctx.state.c) | 5673 assert_equal(4, ctx.state.c) |
5674 END | 5674 END |
5675 v9.CheckSourceSuccess(lines) | 5675 v9.CheckSourceSuccess(lines) |
5676 enddef | 5676 enddef |
5677 | 5677 |
5678 " The following test was failing after 9.0.1914. This was caused by using a | |
5679 " freed object from a previous method call. | |
5680 def Test_freed_object_from_previous_method_call() | |
5681 var lines =<< trim END | |
5682 vim9script | |
5683 | |
5684 class Context | |
5685 endclass | |
5686 | |
5687 class Result | |
5688 endclass | |
5689 | |
5690 def Failure(): Result | |
5691 return Result.new() | |
5692 enddef | |
5693 | |
5694 def GetResult(ctx: Context): Result | |
5695 return Failure() | |
5696 enddef | |
5697 | |
5698 def Test_GetResult() | |
5699 var ctx = Context.new() | |
5700 var result = GetResult(ctx) | |
5701 enddef | |
5702 | |
5703 Test_GetResult() | |
5704 END | |
5705 v9.CheckSourceSuccess(lines) | |
5706 enddef | |
5707 | |
5678 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 5708 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |