0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 9.0.1209: getting interface member does not always work

Problem:    Getting interface member does not always work.
Solution:   Convert the index on the interface to the index on the object.
            (closes #11825)
This commit is contained in:
Bram Moolenaar
2023-01-16 19:43:47 +00:00
parent a41e221935
commit 29ac5df37b
11 changed files with 162 additions and 20 deletions

View File

@@ -870,6 +870,32 @@ def Test_class_implements_interface()
endclass
END
v9.CheckScriptFailure(lines, 'E1349: Function "Methods" of interface "Some" not implemented')
# Check different order of members in class and interface works.
lines =<< trim END
vim9script
interface Result
this.label: string
this.errpos: number
endinterface
# order of members is opposite of interface
class Failure implements Result
this.errpos: number = 42
this.label: string = 'label'
endclass
def Test()
var result: Result = Failure.new()
assert_equal('label', result.label)
assert_equal(42, result.errpos)
enddef
Test()
END
v9.CheckScriptSuccess(lines)
enddef
def Test_class_used_as_type()