rescript-lang / rescript-lang/rescript
[reanalyze] [bug] panic calls should not result in suggested annotations
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 7.5k
- Forks
- 485
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 55
Description
repro:
let foo = () => {
panic("foo")
}
reanalyze gives:
{
"name": "Exception Analysis",
"kind": "warning",
"file": "Foo.res",
"range": [20,4,20,7],
"message": "foo might raise JsExn (Foo.res:22:2) and is not annotated with @raises(JsExn)",
"annotate": { "line": 20, "character": 0, "text": "@raises(JsExn)\n", "action": "Add @raises annotation"}
}
although technically correct, it's not interesting because you're never supposed to catch it anyway.
either replace the exception thrown by panic to be named Panic and keep the raises annotation suggestion (makes it clear that the path can panic) or have reanalyze exclude panic calls from analysis.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the panic example through reanalyze and inspect the Exception Analysis handling for panic calls. Determine with maintainers whether panic should be excluded or reported as a distinct exception, then verify that the resulting output no longer suggests an inappropriate @raises(JsExn) annotation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100