Catching on exception from other module leads to incorrect warning
fhammerschmidt opened this issue · 3 comments
fhammerschmidt commented
Consider the following example:
module Test = {
exception Nested
@raises(Nested)
let raises = async () => raise(Nested)
}
let raises = async () =>
try await Test.raises() catch {
| Test.Nested => Js.log("Not found")
}
it gives me:
raises might raise Nested (test.res:9:12) and is not annotated with @raises(Nested)
However, if I open Test
instead:
module Test = {
exception Nested
@raises(Nested)
let raises = async () => raise(Nested)
}
open Test
let raises = async () =>
try await Test.raises() catch {
| Nested => Js.log("Not found")
}
Everything works fine
cristianoc commented
The exception analysis has a simple model for exception paths, which are taken literally.
It does not try to resolve scope or aliasing.
cristianoc commented
Btw the analysis is now integrated in the editor extension, so this could be moved there.
fhammerschmidt commented
Ok, closing this in favor of rescript-lang/rescript-vscode#716