Skip to content

[reanalyze] [bug] division_by_zero exception analysis should check constant denominators #7679

@tx46

Description

@tx46

repro:

let foo = (x: int) => {
  x / 10
}

reanalyze gives:

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

it's trivially clear that division by zero can't happen, and so reanalyze should not suggest the annotation.

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