You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letfolder(state:State)(result:SingleResult):FinalFileResult * State = result state
36
36
37
37
[<RequireQualifiedAccess>]
38
-
typeDependency=
38
+
typeNodeToTypeCheck=
39
+
/// A real physical file in the current project.
40
+
/// This can be either an implementation or a signature file.
39
41
| PhysicalFile offileIndex:int
40
-
| Pair ofsignatureFileIndex:int
42
+
/// An artificial node that will add the earlier processed signature information to the TcEnvFromImpls.
43
+
/// Dependants on this type of node will perceive that a file is known in both TcEnvFromSignatures and TcEnvFromImpls.
44
+
/// Even though the actual implementation file was not type-checked.
45
+
| ArtificialImplFile ofsignatureFileIndex:int
41
46
42
47
/// Use parallel checking of implementation files that have signature files
43
48
letCheckMultipleInputsInParallel
@@ -63,28 +68,25 @@ let CheckMultipleInputsInParallel
63
68
// When type checking a file, depending on the type (implementation or signature), it will use one of these typing environments (TcEnv).
64
69
// Checking a file will populate the respective TcEnv.
65
70
//
66
-
// When a file has a dependencies, the information of the signature file in case a pair (1) will suffice to type-check the file.
67
-
// Example: if `B.fs` has a dependency on `A`, the information of `A.fsi` is enough for `B.fs` to type-check,
68
-
// on condition that it is available in the TcEnvFromImpls.
69
-
// We introduce a special Pair dependency node in the graph to satisfy this. `B.fs -> [ A.fsi ]` becomes `B.fs -> [ Pair<A> ].
70
-
// The `Pair<A>` node will duplicate the signature information which A.fsi provided.
71
-
// Processing a Pair will add the information from the TcEnvFromSignatures to the TcEnvFromImpls.
71
+
// When a file has a dependencies, the information of the signature file in case a pair (implementation file backed by a signature) will suffice to type-check that file.
72
+
// Example: if `B.fs` has a dependency on `A`, the information of `A.fsi` is enough for `B.fs` to type-check, on condition that information is available in the TcEnvFromImpls.
73
+
// We introduce a special ArtificialImplFile node in the graph to satisfy this. `B.fs -> [ A.fsi ]` becomes `B.fs -> [ ArtificialImplFile A ].
74
+
// The `ArtificialImplFile A` node will duplicate the signature information which A.fsi provided earlier.
75
+
// Processing a `ArtificialImplFile` node will add the information from the TcEnvFromSignatures to the TcEnvFromImpls.
72
76
// This means `A` will be known in both TcEnvs and therefor `B.fs` can be type-checked.
73
77
// By doing this, we can speed up the graph processing as type checking a signature file is less expensive than its implementation counterpart.
74
78
//
75
-
// When we need to actually type-check the implementation file of a Pair, we cannot have the duplicate information of the signature file present in TcEnvFromImpls.
76
-
// Example `A.fs -> [ A.fsi ]`, because an implementation file always depends on its signature.
77
-
// Type-checking `A.fs` will add the actual information to TcEnvFromImpls and we do not depend on the Pair<A> for `A.fs` itself.
79
+
// When we need to actually type-check an implementation file backed by a signature, we cannot have the duplicate information of the signature file present in TcEnvFromImpls.
80
+
// Example `A.fs -> [ A.fsi ]`. An implementation file always depends on its signature.
81
+
// Type-checking `A.fs` will add the actual information to TcEnvFromImpls and we do not depend on the `ArtificialImplFile A` for `A.fs`.
78
82
//
79
-
// In order to deal correctly with the Pair logic, we need to transform the resolved graph to contain the additional pair nodes.
80
-
// After we have type-checked the graph, we exclude the Pair nodes as they are not actual physical files in our project.
81
-
//
82
-
// (1) : A pair is consider the combination of a implementation and signature file. (For example `A.fsi` and matching `A.fs` is Pair<A>)
83
-
letdependencyGraph=
84
-
letmkPair n = Dependency.Pair n
85
-
letmkPhysicalFile n = Dependency.PhysicalFile n
83
+
// In order to deal correctly with the `ArtificialImplFile` logic, we need to transform the resolved graph to contain the additional pair nodes.
84
+
// After we have type-checked the graph, we exclude the ArtificialImplFile nodes as they are not actual physical files in our project.
85
+
letnodeGraph=
86
+
letmkArtificialImplFile n = NodeToTypeCheck.ArtificialImplFile n
87
+
letmkPhysicalFile n = NodeToTypeCheck.PhysicalFile n
86
88
87
-
// Map any signature dependencies to the Pair counterparts.
89
+
// Map any signature dependencies to the ArtificialImplFile counterparts.
88
90
// Unless, the signature dependency is the backing file of the current (implementation) file.
89
91
letmapDependencies idx deps =
90
92
Array.map
@@ -97,21 +99,21 @@ let CheckMultipleInputsInParallel
97
99
// Keep using the physical file
98
100
mkPhysicalFile dep
99
101
else
100
-
mkPair dep
102
+
mkArtificialImplFile dep
101
103
else
102
104
mkPhysicalFile dep)
103
105
deps
104
106
105
-
// Transform the graph to include Pair nodes when necessary.
107
+
// Transform the graph to include ArtificialImplFile nodes when necessary.
106
108
graph
107
109
|> Seq.collect (fun(KeyValue(fileIdx,deps))->
108
110
if filePairs.IsSignature fileIdx then
109
-
// Add an additional Pair node for the signature file.
111
+
// Add an additional ArtificialImplFile node for the signature file.
110
112
[|
111
113
// Mark the current file as physical and map the dependencies.
0 commit comments