To: vim_dev@googlegroups.com Subject: Patch 9.0.1249 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1249 Problem: Cannot export an abstract class. (Ernie Rael) Solution: Add the EX_EXPORT flag to :abstract. (closes #11884) Files: src/ex_cmds.h, src/errors.h, src/vim9class.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1248/src/ex_cmds.h 2023-01-26 20:36:52.326474318 +0000 --- src/ex_cmds.h 2023-01-27 12:56:51.070173427 +0000 *************** *** 128,134 **** EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM, ADDR_NONE), EXCMD(CMD_abstract, "abstract", ex_class, ! EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_all, "all", ex_all, EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR, --- 128,134 ---- EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM, ADDR_NONE), EXCMD(CMD_abstract, "abstract", ex_class, ! EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, ADDR_NONE), EXCMD(CMD_all, "all", ex_all, EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR, *** ../vim-9.0.1248/src/errors.h 2023-01-20 16:00:49.538341275 +0000 --- src/errors.h 2023-01-27 13:01:29.866025673 +0000 *************** *** 3442,3445 **** --- 3442,3447 ---- INIT(= N_("E1358: Using \"super\" not in a child class")); EXTERN char e_cannot_define_new_function_in_abstract_class[] INIT(= N_("E1359: Cannot define a \"new\" function in an abstract class")); + EXTERN char e_invalid_command_str_expected_str[] + INIT(= N_("E476: Invalid command: %s, expected %s")); #endif *** ../vim-9.0.1248/src/vim9class.c 2023-01-24 15:07:00.424562535 +0000 --- src/vim9class.c 2023-01-27 13:01:23.442029300 +0000 *************** *** 423,429 **** char *wrong_name = is_class ? "endinterface" : "endclass"; if (checkforcmd(&p, wrong_name, is_class ? 5 : 4)) { ! semsg(_(e_invalid_command_str), line); break; } --- 423,429 ---- char *wrong_name = is_class ? "endinterface" : "endclass"; if (checkforcmd(&p, wrong_name, is_class ? 5 : 4)) { ! semsg(_(e_invalid_command_str_expected_str), line, end_name); break; } *** ../vim-9.0.1248/src/testdir/test_vim9_class.vim 2023-01-26 20:36:52.326474318 +0000 --- src/testdir/test_vim9_class.vim 2023-01-27 13:14:02.346737031 +0000 *************** *** 164,169 **** --- 164,187 ---- v9.CheckScriptSuccess(lines) enddef + def Test_class_interface_wrong_end() + var lines =<< trim END + vim9script + abstract class SomeName + this.member = 'text' + endinterface + END + v9.CheckScriptFailure(lines, 'E476: Invalid command: endinterface, expected endclass') + + lines =<< trim END + vim9script + export interface AnotherName + this.member: string + endclass + END + v9.CheckScriptFailure(lines, 'E476: Invalid command: endclass, expected endinterface') + enddef + def Test_class_member_initializer() var lines =<< trim END vim9script *************** *** 845,850 **** --- 863,882 ---- enddef END v9.CheckScriptSuccess(lines) + + var imported =<< trim END + vim9script + export abstract class EnterExit + def Enter(): void + enddef + def Exit(): void + enddef + endclass + END + writefile(imported, 'XdefIntf2.vim', 'D') + + lines[1] = " import './XdefIntf2.vim' as defIntf" + v9.CheckScriptSuccess(lines) enddef def Test_class_implements_interface() *** ../vim-9.0.1248/src/version.c 2023-01-26 20:36:52.326474318 +0000 --- src/version.c 2023-01-27 12:57:27.890155188 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1249, /**/ -- "I can't complain, but sometimes I still do." (Joe Walsh) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///