patch 9.2.1219: Vim9: reading past garray when inheriting interfaces
Problem: Vim9: when a class implements interfaces and extends a class
that implements interfaces, checking whether an interface of
the parent class is already present reads past the garray
structure instead of using its items.
Solution: Use the items of the garray (Yegappan Lakshmanan).
fixes: #21569
closes: #21508
Assisted-by: Claude
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
1 parent
92d4e9beb1
commit
4a61302504
3 files changed
+33
-1
No files matched your search
@@ -1514,6 +1514,36 @@ def Test_interface_method_returns_own_class()
|
||||
v9.CheckSourceFailure(lines, 'E1383: Method "Copy": type mismatch, expected func(): object<I> but got func(): object<Other>', 11)
|
||||
enddef
|
||||
|
||||
" Test for a class inheriting an interface from the parent class, while it
|
||||
" implements several interfaces itself
|
||||
def Test_implements_with_parent_interface()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
interface I1
|
||||
endinterface
|
||||
interface I2
|
||||
endinterface
|
||||
interface I3
|
||||
endinterface
|
||||
interface I4
|
||||
endinterface
|
||||
interface I5
|
||||
def F(): number
|
||||
endinterface
|
||||
class A implements I5
|
||||
def F(): number
|
||||
return 5
|
||||
enddef
|
||||
endclass
|
||||
class B extends A implements I1, I2, I3, I4
|
||||
endclass
|
||||
var i5: I5 = B.new()
|
||||
assert_equal(5, i5.F())
|
||||
assert_true(instanceof(B.new(), I1, I4, I5))
|
||||
END
|
||||
v9.CheckSourceSuccess(lines)
|
||||
enddef
|
||||
|
||||
" Test interface garbage collection {{{1
|
||||
func Test_interface_garbagecollect()
|
||||
let lines =<< trim END
|
||||
|
||||
@@ -743,6 +743,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1219,
|
||||
/**/
|
||||
1218,
|
||||
/**/
|
||||
|
||||
+1
-1
@@ -928,7 +928,7 @@ is_interface_class_present(garray_T *intf_classes_gap, class_T *ifcl)
|
||||
{
|
||||
for (int j = 0; j < intf_classes_gap->ga_len; j++)
|
||||
{
|
||||
if (((class_T **)intf_classes_gap)[j] == ifcl)
|
||||
if (((class_T **)intf_classes_gap->ga_data)[j] == ifcl)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user