When defining a lambda you currently need to also directly specify a return type, which makes sense for strict type checking, but the compiler doesn't correctly check the type of the expression or for a return inside the compound statement.
For example:
var x: Func<num> = (): num -> void; // works - no error
Or also with compounds:
var y: Func<num> = (): num -> {}; // works - no error
Expected Behavior
The compiler should check whether the provided expression matches the type which should be returned by the lambda.
The compiler should check the code paths inside a provided compound and see whether there is an if-statement.
Steps To Reproduce
Define any lambda with an incorrect return expression, missing return statement or invalid return type.
Is there an existing issue for this?
I am following the documentation's guide
This issue exists in the latest version
Current Behavior
When defining a lambda you currently need to also directly specify a return type, which makes sense for strict type checking, but the compiler doesn't correctly check the type of the expression or for a return inside the compound statement.
For example:
Or also with compounds:
Expected Behavior
Steps To Reproduce
Environment