You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0a37396
Browse filesBrowse the repository at this point in the historyBrowse files
Know the remaining stdlib and Belt throwing functions in exception analysis
Why:
The table of throwing library functions in exn_lib.ml is kept by hand,
and the Temporal `fromStringOrThrow` externals, the Intl `*Exn`
externals, `Belt.MutableStack.popOrThrow` and the `getOrThrow`/`getExn`
of `Belt.Map.Dict` and `Belt.Set.Dict` were missing from it, so calls
to them were reported as throwing nothing.
The table now lists them under every module path a call can resolve to,
and `Belt_MutableSet` gets the entries that `Belt.MutableSet` already had.
Reanalyze modified (exception analysis):
Example:
let plainDate = s => Temporal.PlainDate.fromStringOrThrow(s)
@throws(JsExn)
let locales = s => Intl.getCanonicalLocalesExn(s)
Before (reanalyze):
Exception Analysis
StdlibTest.res:4:5-11
locales throws nothing and is annotated with redundant @throws(JsExn)
After (reanalyze):
Exception Analysis
StdlibTest.res:1:5-13
plainDate might throw JsExn (StdlibTest.res:1:21) and is not annotated with @throws(JsExn)
Review: Why not also list Temporal arithmetic, `Int.range` or
`Date.toTemporalInstant`? They throw only for some arguments and their
names don't say so; listing them would flag every call. The table keeps to
functions named `*OrThrow`/`*Exn` plus the explicit throwers.
Fixes#9182
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb
Signed-off-by: Christoph Knittel <ck@cca.io>
- Exception analysis now knows the throwing Temporal `fromStringOrThrow`, Intl `*Exn`, `Belt.MutableStack.popOrThrow` and `Belt.Map.Dict`/`Belt.Set.Dict``getOrThrow` functions.
0 commit comments