JSAbrahams / mamba

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

Exceptions in handle arms not taken into account #374

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Description of Bug

Type checker cannot check whether function returns exception.

How to Reproduce

def g() -> Int raise [Exception] =>
    raise Exception("A")

def f(x: Int) -> Int=>
    g() handle
        err: Exception => x + 10

Gives the following error:

Error: Exceptions not covered: Exception
 --> my_file.mamba:5:5
   4 | def f(x: Int) -> Int =>
   5 |     g() handle
           ^^^
   6 |         err: Exception => x + 10

Expected behavior

Should pass check stage. The handle does have a match arm for the Exception error.