changeset 31831:554bd03ff609 v9.0.1248

patch 9.0.1248: cannot export an interface Commit: https://github.com/vim/vim/commit/53f54e49b7152e93d09ff77406f7eb63b3b5f732 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 26 20:36:56 2023 +0000 patch 9.0.1248: cannot export an interface Problem: Cannot export an interface. (Ernie Rael) Solution: Add the EX_EXPORT flag to :interface. (closes https://github.com/vim/vim/issues/11884)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Jan 2023 21:45:03 +0100
parents 61ec954c0adf
children b8c29a701f66
files src/ex_cmds.h src/testdir/test_vim9_class.vim src/version.c
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -758,7 +758,7 @@ EXCMD(CMD_intro,	"intro",	ex_intro,
 	EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
 	ADDR_NONE),
 EXCMD(CMD_interface,	"interface",	ex_class,
-	EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
+	EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
 	ADDR_NONE),
 EXCMD(CMD_isearch,	"isearch",	ex_findpat,
 	EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -822,6 +822,29 @@ def Test_interface_basics()
       endinterface
   END
   v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5')
+
+  lines =<< trim END
+      vim9script
+      export interface EnterExit
+          def Enter(): void
+          def Exit(): void
+      endinterface
+  END
+  writefile(lines, 'XdefIntf.vim', 'D')
+
+  lines =<< trim END
+      vim9script
+      import './XdefIntf.vim' as defIntf
+      export def With(ee: defIntf.EnterExit, F: func)
+          ee.Enter()
+          try
+              F()
+          finally
+              ee.Exit()
+          endtry
+      enddef
+  END
+  v9.CheckScriptSuccess(lines)
 enddef
 
 def Test_class_implements_interface()
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1248,
+/**/
     1247,
 /**/
     1246,