Closed JSAbrahams closed 2 years ago
The check stage is not able to detect if a function body never actually returns a value. It only checks that we return the correct type when we do.
def f(x: Int) -> Int => return print(x)
checks, as well as
def f(x: Int) -> Int => print(x)
The above should fail because:
print(x)
Int
Description of Bug
The check stage is not able to detect if a function body never actually returns a value. It only checks that we return the correct type when we do.
How to Reproduce
checks, as well as
Expected behavior
The above should fail because:
print(x)
is a statement, so it should error because the body of the function is a statement and not an expression which evaluates to aInt
type.