aDotInTheVoid / skate

Skateboard for the mind
Apache License 2.0
2 stars 0 forks source link

BinOp evaluates rhs even if lhs returns #29

Closed aDotInTheVoid closed 3 years ago

aDotInTheVoid commented 3 years ago
fn demo(x: bool) {
    return {
        print 1;
        if x { return "eret"; };
        2
    } + {
        print 2;
        2
    }
}

fn main() {
    demo(true);
    print("===")
    demo(false);
}

Currently is ourputs

1
2
===
1
2

But it should be

1
===
1
2