rescript-association/reanalyze

Analyzing modules with information from local library

erivas opened this issue · 3 comments

I have a project which has the "usual" bin/lib structure. The binary uses the library in lib, which exposes a function that raises an exception. Is there a way to make the exception analyzer be aware that the code calling this function raises an exception?

I have written the example here. More concretely, I think I would like hello_world.ml:8:10 Call(Mylib.Lib.trace, modulePath:) to use the information from the corresponding lib.ml that was already processed, and warn that it might raise Bad. Is there a way of doing this? Thanks!

@erivas This ended up in master instead of a PR by mistake: cdfda77

It's pretty basic: when looking for MyLib.Foo it also tries Foo. The analysis does not try to do advanced path resolution. But it should work for the cases as in your example.

Wow! Thanks for the quick fix! it indeed solves the example I proposed.

I've updated the example with a setting closer to my real application. I am having the following problem: two files are named the same (in different libraries, in the example lib and otherlib), it seems that the analysis of one of them gets mixed with the analysis of the other: it kind of breaks the analysis of lib,

  Events combine: #events 1
  lib.ml:3:28 raises  Bad

  
  Events combine: #events 1
  lib.ml:5:13 Call(trace, modulePath:) 

but doesn't report that lib.ml:5 will raise an exception. Does the problem appear in the Scanning phase when building the table?

@erivas that's exactly the limitation with that basic path resolution: it does not distinguish between identical file names in different libs.