Closed JSAbrahams closed 1 year ago
The "weird error" in the check stage, at first glance, would appear to be related to #296
Merging #360 (2198785) into develop (e90633d) will increase coverage by
0.01%
. The diff coverage is92.59%
.
@@ Coverage Diff @@
## develop #360 +/- ##
===========================================
+ Coverage 86.96% 86.97% +0.01%
===========================================
Files 108 108
Lines 11705 11727 +22
===========================================
+ Hits 10179 10200 +21
- Misses 1526 1527 +1
Relevant issues
Resolves #164
Summary
Function with return last item in function body. We do this by making use of the state in the generate stage. When a function has a return in the signature, a flag is set in the state. This flag is then used in the generate of the body, but it is not propagated further to prevent returns being inserted deep within the AST where they shouldn't be. If set to true, then we in most situations wrap the final item of the function body in a core return node. Exceptions are explained below.
If function body does not end with an expression, then the check stage already gives an error (we tested this before, right? Maybe check). We have some exceptions:
Also exposed a weird error in check stage. In
function/definition.mamba
, line 7: Changeif True then return 10 else return None
Toif True then 10 else None
Gives type error:Unifying two types: Expected an Int, was a None
Not something to fix in this PR, it is erroneous behaviour as the mamba script is well-typed according to current spec.Added Tests