Skip to content

Commit 6cb01a1

Browse files
committed
Add scenario with dependent signature files.
1 parent ec8fca7 commit 6cb01a1

2 files changed

Lines changed: 88 additions & 6 deletions

File tree

tests/ParallelTypeCheckingTests/Code/DependencyResolution.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ let mkGraph (files: FileWithAST array) : Graph<int> =
188188
let implIdx =
189189
files
190190
|> Array.skip (f.Idx + 1)
191-
|> Array.tryFind (fun (implFile: FileWithAST) -> $"{implFile.AST.FileName}i" = f.File)
191+
|> Array.tryFind (fun (implFile: FileWithAST) -> $"{implFile.File}i" = f.File)
192192

193193
Option.map (fun (implFile: FileWithAST) -> (implFile.Idx, f.Idx), (f.Idx, implFile.Idx)) implIdx
194194
| ParsedInput.ImplFile _ -> None)

tests/ParallelTypeCheckingTests/Tests/Scenarios.fs

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ type Y = { Q: int }
203203
scenario
204204
"Signature files are being used to construct the Trie"
205205
[
206-
sourceFile
206+
sourceFile // 0
207207
"A.fsi"
208208
"""
209209
module A
210210
211211
val a: int -> int
212212
"""
213213
Set.empty
214-
sourceFile
214+
sourceFile // 1
215215
"A.fs"
216216
"""
217217
module A
@@ -221,15 +221,15 @@ module Helpers =
221221
222222
let a b = Helpers.impl b
223223
"""
224-
Set.empty
225-
sourceFile
224+
(set [| 0 |])
225+
sourceFile // 2
226226
"B.fs"
227227
"""
228228
module B
229229
230230
let b = A.a 42
231231
"""
232-
(set [| 0 |])
232+
(set [| 1 |])
233233
]
234234
scenario
235235
"A partial open statement still links to a file as a last resort"
@@ -359,4 +359,86 @@ let person: string = A.B.C.D.Name
359359
"""
360360
(set [| 0 |])
361361
]
362+
// Diamond scenario
363+
scenario
364+
"Dependent signature files"
365+
[
366+
sourceFile // 0
367+
"A.fsi"
368+
"""
369+
module A
370+
371+
type AType = class end
372+
"""
373+
Set.empty
374+
sourceFile // 1
375+
"A.fs"
376+
"""
377+
module A
378+
379+
type AType = class end
380+
"""
381+
(set [| 0 |])
382+
sourceFile // 2
383+
"B.fsi"
384+
"""
385+
module B
386+
387+
open A
388+
389+
val b: AType -> unit
390+
"""
391+
(set [| 1 |])
392+
sourceFile // 3
393+
"B.fs"
394+
"""
395+
module B
396+
397+
open A
398+
399+
let b (a:AType) = ()
400+
"""
401+
(set [| 1; 2 |])
402+
sourceFile // 4
403+
"C.fsi"
404+
"""
405+
module C
406+
407+
type CType = class end
408+
"""
409+
Set.empty
410+
sourceFile // 5
411+
"C.fs"
412+
"""
413+
module C
414+
415+
type CType = class end
416+
"""
417+
(set [| 4 |])
418+
sourceFile // 6
419+
"D.fsi"
420+
"""
421+
module D
422+
423+
open A
424+
open C
425+
426+
val d: CType -> unit
427+
"""
428+
(set [| 1; 5 |])
429+
sourceFile // 7
430+
"D.fs"
431+
"""
432+
module D
433+
434+
open A
435+
open B
436+
open C
437+
438+
let d (c: CType) =
439+
let a : AType = failwith "todo"
440+
b a
441+
"""
442+
(set [| 1; 3; 5; 6 |])
443+
]
362444
]

0 commit comments

Comments
 (0)