Fix missing value for first item of enums with trailing comma
The value of the first item of an enum with a trailing comma after its
last item was not correctly initialized to 0 any more after the changes
of 74adaa5738 (see #1515) because "_last"
attribute was not set correctly in this case.
Do set it for the last item when it's followed by a comma too and add
more unit tests checking for this.
Closes #1566.
This commit is contained in:
parent
2db6b42715
commit
c321aca2b4
3 changed files with 31 additions and 0 deletions
|
|
@ -13,6 +13,12 @@ public class java_enums_runme implements stuff {
|
|||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
if (WithTrailingComma.Second != 1)
|
||||
throw new RuntimeException("Incorrect value for Second");
|
||||
|
||||
if (WithTrailingCommaAndIgnoredFirstItem.SecondNonIgnoredOne != 2)
|
||||
throw new RuntimeException("Incorrect value for SecondNonIgnoredOne");
|
||||
|
||||
int number = 200;
|
||||
|
||||
// Switch statement will only compile if these enums are initialised
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue