epsilon icon indicating copy to clipboard operation
epsilon copied to clipboard

[EOL] Parser crashes if there is a missing semicolon inside an `else` block inside a loop

Open Arkaedan opened this issue 7 months ago • 0 comments

while (false) {
    if (true) {
        "hello".println();
    } else {
        "world".println()
    }
}

or

for (num in Set {1,2}) {
    if (true) {
        "hello".println();
    } else {
        "world".println()
    }
}

Both of these cause the parser to crash with the following exception:

java.lang.IllegalArgumentException: null was expected to be a StatementBlock, Statement or Expression but instead it is null

A normal parse problem is reported (correct behaviour) in the following situations:

if (false) {
    if (true) {
        "hello".println();
    } else {
        "world".println()
    }
}
// or
while (false) {
    if (true) {
        "hello".println()
    } else {
        "world".println();
    }
}
// or
if (true) {
    "hello".println();
} else {
    "world".println()
}

Arkaedan avatar Jun 10 '25 04:06 Arkaedan