Skip to content

[reanalyze] [bug] nested functions trigger @raises annotation #7677

Description

@tx46

repro:

exception MyException
let foo = () => {
  @raises(MyException)
  let bar = () => {
    throw(MyException)
  }
  {"bar": bar}
}

it's trivial to see above that foo can never raise MyException. despite this, reanalyze exception analysis suggests that foo should be annotated:

{
  "name": "Exception Analysis",
  "kind": "warning",
  "file": "Foo.res",
  "range": [21,4,21,7],
  "message": "foo might raise MyException (Foo.res:27:10) and is not annotated with @raises(MyException)",
  "annotate": { "line": 21, "character": 0, "text": "@raises(MyException)\n", "action": "Add @raises annotation"}
}

this is incorrect and the annotation should not be suggested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions