1
0
forked from aniani/vim

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>
This commit is contained in:
Yegappan Lakshmanan
2023-09-24 23:09:10 +02:00
committed by Christian Brabandt
parent 960822a11f
commit 7398f367d5
3 changed files with 41 additions and 9 deletions

View File

@@ -5675,4 +5675,34 @@ def Test_dict_object_member()
v9.CheckSourceSuccess(lines)
enddef
" The following test was failing after 9.0.1914. This was caused by using a
" freed object from a previous method call.
def Test_freed_object_from_previous_method_call()
var lines =<< trim END
vim9script
class Context
endclass
class Result
endclass
def Failure(): Result
return Result.new()
enddef
def GetResult(ctx: Context): Result
return Failure()
enddef
def Test_GetResult()
var ctx = Context.new()
var result = GetResult(ctx)
enddef
Test_GetResult()
END
v9.CheckSourceSuccess(lines)
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker