Skip to content

Commit

Permalink
Add scenario with dependent signature files.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 24, 2022
1 parent ec8fca7 commit 6cb01a1
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ let mkGraph (files: FileWithAST array) : Graph<int> =
let implIdx =
files
|> Array.skip (f.Idx + 1)
|> Array.tryFind (fun (implFile: FileWithAST) -> $"{implFile.AST.FileName}i" = f.File)
|> Array.tryFind (fun (implFile: FileWithAST) -> $"{implFile.File}i" = f.File)

Option.map (fun (implFile: FileWithAST) -> (implFile.Idx, f.Idx), (f.Idx, implFile.Idx)) implIdx
| ParsedInput.ImplFile _ -> None)
Expand Down
92 changes: 87 additions & 5 deletions tests/ParallelTypeCheckingTests/Tests/Scenarios.fs
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ type Y = { Q: int }
scenario
"Signature files are being used to construct the Trie"
[
sourceFile
sourceFile // 0
"A.fsi"
"""
module A
val a: int -> int
"""
Set.empty
sourceFile
sourceFile // 1
"A.fs"
"""
module A
Expand All @@ -221,15 +221,15 @@ module Helpers =
let a b = Helpers.impl b
"""
Set.empty
sourceFile
(set [| 0 |])
sourceFile // 2
"B.fs"
"""
module B
let b = A.a 42
"""
(set [| 0 |])
(set [| 1 |])
]
scenario
"A partial open statement still links to a file as a last resort"
Expand Down Expand Up @@ -359,4 +359,86 @@ let person: string = A.B.C.D.Name
"""
(set [| 0 |])
]
// Diamond scenario
scenario
"Dependent signature files"
[
sourceFile // 0
"A.fsi"
"""
module A
type AType = class end
"""
Set.empty
sourceFile // 1
"A.fs"
"""
module A
type AType = class end
"""
(set [| 0 |])
sourceFile // 2
"B.fsi"
"""
module B
open A
val b: AType -> unit
"""
(set [| 1 |])
sourceFile // 3
"B.fs"
"""
module B
open A
let b (a:AType) = ()
"""
(set [| 1; 2 |])
sourceFile // 4
"C.fsi"
"""
module C
type CType = class end
"""
Set.empty
sourceFile // 5
"C.fs"
"""
module C
type CType = class end
"""
(set [| 4 |])
sourceFile // 6
"D.fsi"
"""
module D
open A
open C
val d: CType -> unit
"""
(set [| 1; 5 |])
sourceFile // 7
"D.fs"
"""
module D
open A
open B
open C
let d (c: CType) =
let a : AType = failwith "todo"
b a
"""
(set [| 1; 3; 5; 6 |])
]
]

0 comments on commit 6cb01a1

Please sign in to comment.