@@ -88,6 +88,33 @@ let x = 1
8888 ]
8989 assertGraphEqual deps expectedEdges
9090
91+ [<Test>]
92+ let ``Files with module or type abbreviations depend on all files above`` () =
93+ let files =
94+ [|
95+ " A.fs" , """
96+ module A
97+ """
98+ " B.fs" , """
99+ module B
100+ module X = Y
101+ """
102+ " C.fs" , """
103+ module C
104+ type X = Y
105+ """
106+ |]
107+ |> buildFiles
108+
109+ let deps = DependencyResolution.detectFileDependencies files
110+
111+ let expectedEdges =
112+ [
113+ " B.fs" , [ " A.fs" ]
114+ " C.fs" , [ " A.fs" ; " B.fs" ]
115+ ]
116+ assertGraphEqual deps expectedEdges
117+
91118
92119let sampleFiles =
93120 [
@@ -177,10 +204,10 @@ let private parseProjectAndGetSourceFiles (projectFile : string) =
177204 log " built project using Buildalyzer"
178205 files
179206
180- [<TestCase( @" C:\projekty\fsharp\heuristic\tests \FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" ) >]
181- [<TestCase( @" C:\projekty\fsharp\fsharp_main \src\Compiler\FSharp.Compiler.Service.fsproj" ) >]
207+ [<TestCase(__ SOURCE _ DIRECTORY __ + @" \..\.. \FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" ) >]
208+ [<TestCase(__ SOURCE _ DIRECTORY __ + @" \..\..\.. \src\Compiler\FSharp.Compiler.Service.fsproj" ) >]
182209[<Explicit( " Slow as it uses Buildalyzer to analyse (build) projects first" ) >]
183- let ``Test fsproj files `` ( projectFile : string ) =
210+ let ``Analyse whole projects and print statistics `` ( projectFile : string ) =
184211 log $" Start finding file dependency graph for {projectFile}"
185212 let files = parseProjectAndGetSourceFiles projectFile
186213 let files =
@@ -213,11 +240,11 @@ let ``Test fsproj files`` (projectFile : string) =
213240
214241 analyseEfficiency graph
215242
216- let totalDeps = graph.Graph |> Seq.sumBy ( fun ( KeyValue ( k , v )) -> v.Length)
243+ let totalDeps = graph.Graph |> Seq.sumBy ( fun ( KeyValue ( _k , v )) -> v.Length)
217244 let topFirstDeps =
218245 graph.Graph
219246 |> Seq.sumBy (
220- fun ( KeyValue ( k , v )) ->
247+ fun ( KeyValue ( _k , v )) ->
221248 if v.Length = 0 then 0
222249 else v |> Array.map ( fun d -> graph.Graph[ d]. Length) |> Array.max
223250 )
0 commit comments