dfinity / motoko

Simple high-level language for writing Internet Computer canisters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: incorrect unused identifier warning

crusso opened this issue · comments

This code says that e is unused even though it is used.

module {
  public func foo() : async () {
    var x = try {} catch (e) { throw e };
    x;
  };
};

This example seems somewhat minimal. For example without the var x = the error does not occur. With let instead of var it also does not occur.

Also, and perhaps related:

module {
  public func foo() : async () {
    try {} catch (e) { };
  };
};

does not report that e is unused.

https://dfinity.slack.com/archives/CPL67E7MX/p1713629264089809

Thank you for reporting. The PR #4560 should fix this issue.