JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Check does not notice erroneous types when assigning using nested ifs #375

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Description of Bug

Check does not notice erroneous types when assigning using nested ifs.

How to Reproduce

def x := 20
def a: int := if x > 10 then
    if x > 30 then
        "a string"
    else
        x - 1
else
    x

Expected behavior

Should fail because a has type Int even though there is a possibility it could be a string.