Skip to content

Commit 9857439

Browse files
authored
Merge pull request #14 from safesparrow/tcSigEnv-merging-updated
2 parents e550115 + 9fa6952 commit 9857439

4 files changed

Lines changed: 79 additions & 15 deletions

File tree

src/Compiler/Driver/ParseAndCheckInputs.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,15 +1470,17 @@ let CheckOneInputAux'
14701470
let fsiPartialResult, tcState =
14711471
let rootSigs = Zmap.add qualNameOfFile sigFileType tcState.tcsRootSigs
14721472

1473+
let tcSigEnv =
1474+
AddLocalRootModuleOrNamespace TcResultsSink.NoSink tcGlobals amap m tcState.tcsTcSigEnv sigFileType
1475+
14731476
// Add the signature to the signature env (unless it had an explicit signature)
14741477
let ccuSigForFile = CombineCcuContentFragments [ sigFileType; tcState.tcsCcuSig ]
14751478

14761479
let partialResult = tcEnv, EmptyTopAttrs, None, ccuSigForFile
14771480

14781481
let tcState =
14791482
{ tcState with
1480-
tcsTcSigEnv = tcEnv
1481-
tcsTcImplEnv = tcState.tcsTcImplEnv
1483+
tcsTcSigEnv = tcSigEnv
14821484
tcsRootSigs = rootSigs
14831485
tcsCreatesGeneratedProvidedTypes =
14841486
tcState.tcsCreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes

tests/ParallelTypeCheckingTests/Code/DependencyResolution.fs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,6 @@ module internal DependencyResolution =
149149

150150
let trie = buildTrie nodes
151151

152-
let fsiFiles =
153-
nodes
154-
|> Array.filter (fun f ->
155-
match f.File.AST with
156-
| ASTOrFsix.AST (ParsedInput.SigFile _) -> true
157-
| _ -> false)
158-
159152
let processFile (node: FileData) =
160153
let deps =
161154
let fsiDep =
@@ -231,17 +224,13 @@ module internal DependencyResolution =
231224
// Process module refs in order, marking more and more TrieNodes as reachable and potential prefixes
232225
moduleRefs |> Array.iter processRef
233226

234-
// Force .fsi files to depend on all other (previous) .fsi files - avoids the issue of TcEnv being overriden
235-
let additionalFsiDeps = if node.File.Name.EndsWith ".fsi" then nodes else [||]
236-
237227
// Collect files from all reachable TrieNodes
238228
let deps =
239229
reachable
240230
|> Seq.collect (fun node -> node.Files)
241231
// Assume that this file depends on all files that have any module abbreviations - this is probably unnecessary.
242232
// TODO Handle module abbreviations in a better way
243233
|> Seq.append filesWithModuleAbbreviations
244-
|> Seq.append additionalFsiDeps
245234
|> Seq.append fsiDep
246235
|> Seq.map (fun f -> f.File)
247236
|> Seq.toArray

tests/ParallelTypeCheckingTests/Tests/TestCompilation.fs

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,80 @@ open A
129129
]
130130
|> FProject.Make CompileOutput.Library
131131

132-
let all = [ encodeDecodeSimple; diamondBroken1; fsFsi; emptyNamespace ]
132+
let dependentSignatures =
133+
[
134+
"A.fsi",
135+
"""
136+
module A
137+
138+
type AType = class end
139+
"""
140+
"A.fs",
141+
"""
142+
module A
143+
144+
type AType = class end
145+
"""
146+
"B.fsi",
147+
"""
148+
module B
149+
150+
open A
151+
152+
val b: AType -> unit
153+
"""
154+
"B.fs",
155+
"""
156+
module B
157+
158+
open A
159+
160+
let b (a:AType) = ()
161+
"""
162+
"C.fsi",
163+
"""
164+
module C
165+
166+
type CType = class end
167+
"""
168+
"C.fs",
169+
"""
170+
module C
171+
172+
type CType = class end
173+
"""
174+
"D.fsi",
175+
"""
176+
module D
177+
178+
open A
179+
open C
180+
181+
val d: CType -> unit
182+
"""
183+
"D.fs",
184+
"""
185+
module D
186+
187+
open A
188+
open B
189+
open C
190+
191+
let d (c: CType) =
192+
let a : AType = failwith "todo"
193+
b a
194+
"""
195+
]
196+
|> FProject.Make CompileOutput.Library
197+
198+
let all =
199+
[
200+
encodeDecodeSimple
201+
diamondBroken1
202+
fsFsi
203+
emptyNamespace
204+
dependentSignatures
205+
]
133206

134207
type Case =
135208
{

tests/ParallelTypeCheckingTests/Tests/TestDependencyResolution.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ let ``Analyse whole projects and print statistics`` (projectFile: string) =
269269
files
270270
|> Array.Parallel.mapi (fun i f ->
271271
let code = System.IO.File.ReadAllText(f)
272-
let ast = getParseResults code
272+
let ast = parseSourceCode (f, code)
273273

274274
{
275275
Idx = FileIdx.make i

0 commit comments

Comments
 (0)