Lesma icon indicating copy to clipboard operation
Lesma copied to clipboard

Function definitions don't recognize that if all conditionals have a return, it will always return

Open alinalihassan opened this issue 2 years ago • 0 comments

Function definitions don't recognize that if all conditionals have a return, it will always return. Instead they complain that there's no return in the main block of the function. Take this example:

def test(x: int) -> int
    if x > 5
        return 5
    else
        return 7

Currently Lesma can't compile that. We might be able to get away by just modifying the code generator, not including any analysis steps of sorts.

alinalihassan avatar Sep 03 '22 08:09 alinalihassan