Skip to content

Commit

Permalink
still doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
safesparrow committed Nov 1, 2022
1 parent 3e65c3c commit 9f991d4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/Compiler/Driver/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,11 +1603,18 @@ let CheckOneInputAux'

printfn $"Finished Processing Impl {file.FileName}"
return fun tcState ->
printfn $"Applying Impl {file.FileName}"
let backed = rootSigOpt.IsSome
printfn $"Applying Impl Backed={backed} {file.FileName}"



let ccuSigForFile, fsTcState =
AddCheckResultsToTcState
(tcGlobals, amap, false, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, implFile.Signature)
tcState

// backed impl files must not add results as there are already results from .fsi files
let fsTcState = if backed then tcState else fsTcState

let partialResult = tcEnvAtEnd, topAttrs, Some implFile, ccuSigForFile

Expand Down
14 changes: 9 additions & 5 deletions tests/FSharp.Compiler.Service.Tests2/DepResolving.fs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module internal AutomatedDependencyResolving =
let deps =
// Assume that a file with module abbreviations can depend on anything
match node.Data.ContainsModuleAbbreviations with
| true -> nodes
| true -> nodes |> Array.map (fun n -> n.File)
| false ->
// Clone the original Trie as we're going to mutate the copy
let trie = cloneTrie trie
Expand Down Expand Up @@ -226,16 +226,18 @@ module internal AutomatedDependencyResolving =
// For starters: can module abbreviations affect other files?
// If not, then the below is not necessary.
|> Seq.append filesWithModuleAbbreviations
|> Seq.map (fun f -> f.File)
|> Seq.toArray

deps
// We know a file can't depend on a file further down in the project definition (or on itself)
|> Array.filter (fun dep -> dep.File.Idx < node.File.Idx)
|> Array.filter (fun dep -> dep.Idx < node.File.Idx)
// Filter out deps onto .fs files that have backing .fsi files
|> Array.filter (fun dep -> not dep.File.FsiBacked)
|> Array.filter (fun dep -> not dep.FsiBacked)
|> Array.distinct

// Return the node and its dependencies
node.File, deps |> Array.map (fun d -> d.File)
node.File, deps

// Find dependencies for all files
let graph =
Expand All @@ -248,9 +250,11 @@ module internal AutomatedDependencyResolving =
let totalSize1 =
graph
|> Seq.sumBy (fun (KeyValue(k,v)) -> v.Length)
let totalSize2 =
let t =
graph
|> Graph.transitive
let totalSize2 =
t
|> Seq.sumBy (fun (KeyValue(k,v)) -> v.Length)

printfn $"Non-transitive size: {totalSize1}, transitive size: {totalSize2}"
Expand Down
8 changes: 7 additions & 1 deletion tests/FSharp.Compiler.Service.Tests2/DiamondArgs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,10 @@
--simpleresolution
--refout:C:\projekty\fsharp\heuristic\artifacts\obj\DiamondTest\Debug\net7.0\refint\DiamondTest.dll
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fsi
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\B1.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\B2.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\C1.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\C2.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\D.fs
C:\projekty\fsharp\heuristic\tests\DiamondTest\Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ module internal Real =
printfn $"Finished Processing X {file.Name}"
return
(fun (state : State) ->
// (tcState.TcEnvFromImpls, EmptyTopAttrs, None, ccuSigForFile), state
printfn $"Applying X state {file.Name}"
let tcState, priorErrors = state
// (tcState.TcEnvFromImpls, EmptyTopAttrs, None, ccuSigForFile), state
Expand Down

0 comments on commit 9f991d4

Please sign in to comment.