Skip to content

Commit 5a53925

Browse files
yegappanchrisbra
authored andcommitted
patch 9.0.2088: Vim9: still allows abstract static methods
Problem: Vim9: still allows abstract static methods (after v9.0.2084, v9.0.2085 and v9.0.2087) Solution: Disallow abstract static methods closes: #13479 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent ce3b013 commit 5a53925

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/testdir/test_vim9_class.vim

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5607,15 +5607,13 @@ def Test_abstract_method()
56075607
v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def"', 3)
56085608

56095609
# Use a static abstract method
5610-
# TODO: this does not fail, so skip it for now
5611-
5612-
# lines =<< trim END
5613-
# vim9script
5614-
# abstract class A
5615-
# abstract static def Foo(): number
5616-
# endclass
5617-
# END
5618-
# v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def"', 3)
5610+
lines =<< trim END
5611+
vim9script
5612+
abstract class A
5613+
abstract static def Foo(): number
5614+
endclass
5615+
END
5616+
v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def"', 3)
56195617

56205618
# Type mismatch between abstract method and concrete method
56215619
lines =<< trim END

src/version.c

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

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
2088,
707709
/**/
708710
2087,
709711
/**/

src/vim9class.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,13 +1557,6 @@ ex_class(exarg_T *eap)
15571557
break;
15581558
}
15591559

1560-
p = skipwhite(pa + 8);
1561-
if (STRNCMP(p, "def", 3) != 0 && STRNCMP(p, "static", 6) != 0)
1562-
{
1563-
emsg(_(e_abstract_must_be_followed_by_def));
1564-
break;
1565-
}
1566-
15671560
if (!is_class)
15681561
{
15691562
// "abstract" not supported in an interface
@@ -1577,6 +1570,13 @@ ex_class(exarg_T *eap)
15771570
break;
15781571
}
15791572

1573+
p = skipwhite(pa + 8);
1574+
if (STRNCMP(p, "def", 3) != 0)
1575+
{
1576+
emsg(_(e_abstract_must_be_followed_by_def));
1577+
break;
1578+
}
1579+
15801580
abstract_method = TRUE;
15811581
}
15821582

0 commit comments

Comments
 (0)