0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 9.0.1184: interface of an object is not recognized when checking type

Problem:    Interface of an object is not recognized when checking type.
Solution:   Use the interface implemented by an object.
This commit is contained in:
Bram Moolenaar
2023-01-12 15:01:32 +00:00
parent 0233bdfa2b
commit a94bd9d939
5 changed files with 66 additions and 1 deletions

View File

@@ -455,6 +455,24 @@ def Test_object_type()
var o: One = Two.new()
END
v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object<One> but got object<Two>')
lines =<< trim END
vim9script
interface One
def GetMember(): number
endinterface
class Two implements One
this.one = 1
def GetMember(): number
return this.one
enddef
endclass
var o: One = Two.new(5)
assert_equal(5, o.GetMember())
END
v9.CheckScriptSuccess(lines)
enddef
def Test_class_member()