Open anton-trunov opened 2 months ago
Can't test in Nujan — doing the following throws RangeError: Maximum call stack size exceeded
in Next.js bundled chunks (line:column positions there don't tell anything about the original sources):
import "@stdlib/deploy";
fun foo(a: Int): Int {
if (a <= 1) { return 1; }
return bar(a - 1);
}
fun bar(b: Int): Int {
if (b <= 1 ) { return 1; }
return foo(b - 1);
}
contract Example with Deployable {
init() {} // because there's Tact 1.2.0
get fun call(): Int {
return foo(10) + bar(10); // should return 2, but doesn't build in Nujan
}
}
Meanwhile, the following re-write in TypeScript works and produces 2, as it should:
function foo(a: number): number {
if (a <= 1) { return 1; }
return bar(a - 1);
}
function bar(b: number): number {
if (b <= 1 ) { return 1; }
return foo(b - 1);
}
console.log(foo(10) + bar(10));
I'll investigate this matter locally with Blueprint later on. If that works, I'll file an issue to Nujan
For instance, if I have something like this:
bar
should be able to refer tofoo
, but canfoo
callbar
?