Open safesparrow opened 1 year ago
An interesting case I just found is the following:
// A.fs
module A
type A = int
// B.fs
module B
open A
let b () : A array = [| 0 |]
// C.fs
module C
// The typed tree knows what type A is!
let c = B.b ()
In our current detection we see the following:
A: []
B: [ A ]
C: [ B ]
The typed tree however knows that c
is of type A
. So it sees this instead:
A: []
B: [ A ]
C: [ A; B ]
This doesn't really affect the outcome of the heuristic. When type-checking A
will be known before C
is checked. But it does yield incomplete results in the assertion of #18.
I guess to compare both graphs we should include all dependencies as well.
Yes, we should either compare transitive closures of the graphs or trim the graph from the TypedTree and remove duplicates. The former is much easier (eg. Graph transitiveOpt
) so probably what we should do.
MVP with an example merged in https://github.com/safesparrow/fsharp/pull/18 .
We should productionise/generalise it if it's not already clean/generic enough.