winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.76k stars 187 forks source link

Return statement: check that all control paths return a value #457

Open staycoolcall911 opened 1 year ago

staycoolcall911 commented 1 year ago

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.

staycoolcall911 commented 1 year ago

Requires static analysis

github-actions[bot] commented 1 year ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!