function myRecusiveLoop(i, x) {
if (i <= 0) {
return x * 2;
}
console.log(i);
myRecusiveLoop(i - 1)
}
This is one of the most complex type checking problems but is possible with the following
Hoisting functions (and variables referencing function) will mean that references are known during checking the function body.
There should be a poly type for the result of calling a function whose body hasn't been synthesized (in the cases of recursion/cycles)
For recursion without a type annotation, it has a mutable/inferred restriction. The inferred type should be collected, so that when the recursive body is checked its return type can be checked that it satisfies recursion...
The effects under recursive functions need to be handled the same way as for for statements (which needs writeup, but means backing out of evaluating large loops and shortening to less precise types). apply_effect knows that it is cycle and needs to not get stuck in a infinite loop
When calling mutually recursive functions it also need to take the poly type into account and not register that two functions are called to break tree shaking. e.g.
function x() { y() }
function y() { x() }
both should have no call count
Feel free to comment any code examples you have that you want to work with Ezno's checking features
Eventually want to support
This is one of the most complex type checking problems but is possible with the following
for
statements (which needs writeup, but means backing out of evaluating large loops and shortening to less precise types).apply_effect
knows that it is cycle and needs to not get stuck in a infinite loopboth should have no call count
Feel free to comment any code examples you have that you want to work with Ezno's checking features