Skip to content

Commit 53f54e4

Browse files
committed
patch 9.0.1248: cannot export an interface
Problem: Cannot export an interface. (Ernie Rael) Solution: Add the EX_EXPORT flag to :interface. (closes #11884)
1 parent 870219c commit 53f54e4

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/ex_cmds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ EXCMD(CMD_intro, "intro", ex_intro,
758758
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
759759
ADDR_NONE),
760760
EXCMD(CMD_interface, "interface", ex_class,
761-
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
761+
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
762762
ADDR_NONE),
763763
EXCMD(CMD_isearch, "isearch", ex_findpat,
764764
EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,

src/testdir/test_vim9_class.vim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,29 @@ def Test_interface_basics()
822822
endinterface
823823
END
824824
v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5')
825+
826+
lines =<< trim END
827+
vim9script
828+
export interface EnterExit
829+
def Enter(): void
830+
def Exit(): void
831+
endinterface
832+
END
833+
writefile(lines, 'XdefIntf.vim', 'D')
834+
835+
lines =<< trim END
836+
vim9script
837+
import './XdefIntf.vim' as defIntf
838+
export def With(ee: defIntf.EnterExit, F: func)
839+
ee.Enter()
840+
try
841+
F()
842+
finally
843+
ee.Exit()
844+
endtry
845+
enddef
846+
END
847+
v9.CheckScriptSuccess(lines)
825848
enddef
826849

827850
def Test_class_implements_interface()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1248,
698700
/**/
699701
1247,
700702
/**/

0 commit comments

Comments
 (0)