compilation error Maximum call stack size exceeded
Open
Nobody has claimed this yet.
🐛 bug
🛠️ compiler
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 215
- Avg merge
- 2h 9m
- Merged PRs (30d)
- 27
Description
I tried this:
wing compile
bring cloud;
pub class Workflow {
handlers: MutArray<inflight (Json?): void>;
new(steps: Array<inflight (Json?): void>) {
this.handlers = MutArray<inflight (Json?): void>[];
let signal = new cloud.Topic();
signal.onMessage(inflight (ctx) => {
log(this.handlers.length);
});
for step in steps {
let handler = new cloud.Function(inflight (ctx) => {
this.do();
});
this.handlers.push(inflight (ctx) => {
handler.invokeAsync(Json.stringify(ctx));
});
}
}
pub inflight count(): num {
return this.handlers.length;
}
inflight do() {
}
}
let m = new Workflow([
inflight () => {}
]);
This happened:
Error: Maximum call stack size exceeded
I expected this:
No response
Is there a workaround?
compilation succeeds when commenting out either the count function or the signal.onMessage line
Anything else?
No response
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Wing program with wing compile, then compare the compiler behavior when count() or signal.onMessage is removed. Trace the compilation path that processes these two constructs and identify why it recurses until the call stack is exhausted. Done means the reproduction compiles without either workaround and existing compiler tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100