Return statement: check that all control paths return a value
Open
Nobody has claimed this yet.
📜 lang-spec-impl
🛠️ compiler
roadmap
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 215
- Avg merge
- 2h 9m
- Merged PRs (30d)
- 27
Description
https://github.com/winglang/wing/blob/main/docs/04-reference/winglang-spec.md#24-return
Compiler should add a check that all control paths return a value
Example:
bring cloud;
resource WebHook {
api: cloud.Api;
init() {
this.api = new cloud.Api();
this.api.post("/", inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
log(Json.stringify(req));
});
}
}
The above code should error since the inflight does not return an api response.
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 with the return-statement section of docs/04-reference/winglang-spec.md linked in the issue and compare its requirements with the example. The work is done when the shown inflight function is rejected for lacking a return value while valid control paths that return an API response are accepted.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100