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

patch 9.0.1152: class "implements" argument not implemented

Problem:    Class "implements" argument not implemented.
Solution:   Implement "implements" argument.  Add basic checks for when a
            class implements an interface.
This commit is contained in:
Bram Moolenaar
2023-01-06 18:42:20 +00:00
parent 5bcd29b84e
commit 94674f2223
8 changed files with 249 additions and 14 deletions

View File

@@ -612,5 +612,58 @@ def Test_interface_basics()
v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5')
enddef
def Test_class_implements_interface()
var lines =<< trim END
vim9script
interface Some
static count: number
def Method(nr: number)
endinterface
class SomeImpl implements Some
static count: number
def Method(nr: number)
echo nr
enddef
endclass
END
v9.CheckScriptSuccess(lines)
lines =<< trim END
vim9script
interface Some
static counter: number
def Method(nr: number)
endinterface
class SomeImpl implements Some
static count: number
def Method(nr: number)
echo nr
enddef
endclass
END
v9.CheckScriptFailure(lines, 'E1348: Member "counter" of interface "Some" not implemented')
lines =<< trim END
vim9script
interface Some
static count: number
def Methods(nr: number)
endinterface
class SomeImpl implements Some
static count: number
def Method(nr: number)
echo nr
enddef
endclass
END
v9.CheckScriptFailure(lines, 'E1349: Function "Methods" of interface "Some" not implemented')
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker