Skip to content

Hotfix for if with no else

Compare
Choose a tag to compare
@brwhale brwhale released this 02 May 02:30
· 42 commits to main since this release
b8224e6

Was adding extra tests and noticed an egregious bug, so - hotfix!

the issue was as follows:

fn something() {
    var x = 0;
    if (someVar > 2) { x = 4;}
    return x;
}

That would always return null, but these variations worked fine:

fn something() {
    var x = 0;
    if (someVar > 2) { x = 4;};
    return x;
}

fn something() {
    var x = 0;
    if (someVar > 2) { x = 4;} else {}
    return x;
}

It turned out there was a parse bug that would "eat" the rest of the function after an if block until it hit an else or a ";".

Bug is now fixed so you can write functions ergonomically without worrying about it anymore!