WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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

@tx46

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