Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* Fix signature generation: SRTP constraints use postfix syntax that fails conformance, now uses explicit type param declarations. ([Issue #19594](https://github.com/dotnet/fsharp/issues/19594), [PR #19609](https://github.com/dotnet/fsharp/pull/19609))
* Fix signature generation: type params with special characters missing backtick escaping. ([Issue #19595](https://github.com/dotnet/fsharp/issues/19595), [PR #19609](https://github.com/dotnet/fsharp/pull/19609))
* Fix internal error when using custom attribute with `[<Optional>]` value type parameter and no `[<DefaultParameterValue>]`. ([Issue #8353](https://github.com/dotnet/fsharp/issues/8353), [PR #19484](https://github.com/dotnet/fsharp/pull/19484))
* Fix parallel compilation of scripts ([PR #19649](https://github.com/dotnet/fsharp/pull/19649))

### Added

Expand Down
25 changes: 2 additions & 23 deletions src/Compiler/Driver/GraphChecking/DependencyResolution.fs
Original file line number Diff line number Diff line change
Expand Up @@ -254,31 +254,10 @@ let mkGraph (filePairs: FilePairMap) (files: FileInProject array) : Graph<FileIn

allDependencies

// If there is a script in the project, we just process sequentially all the files that may have been added as part of the script closure.
Comment thread
T-Gro marked this conversation as resolved.
// That means all files up to the last script file.
let scriptCompilationLength =
files
|> Array.tryFindIndexBack (fun f -> f.IsScript)
|> Option.map (fun idx -> idx + 1)
|> Option.defaultValue 0

let sequentialPartForScriptCompilation =
files
|> Array.take scriptCompilationLength
|> Array.map (fun file ->
file.Idx,
[|
if file.Idx > 0 then
file.Idx - 1
|])

let normalPart =
let graph =
files
|> Array.skip scriptCompilationLength
|> Array.Parallel.map (fun file -> file.Idx, findDependencies file)

let graph =
Array.append sequentialPartForScriptCompilation normalPart |> readOnlyDict
|> readOnlyDict

let trie = trie |> Array.last |> snd

Expand Down
8 changes: 1 addition & 7 deletions src/Compiler/Driver/GraphChecking/TrieMapping.fs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,7 @@ let processSynModuleOrNamespace<'Decl>
mkSingletonDict name { Current = current; Children = node } |> continuation)
tail

if kind = SynModuleOrNamespaceKind.AnonModule then
Comment thread
majocha marked this conversation as resolved.
// We collect the child nodes from the decls
decls
|> List.choose (mkTrieForDeclaration idx)
|> mkImmutableDictFromKeyValuePairs
else
visit id name
visit id name

{
Current = Root(ImmutableHashSet.empty ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ module LibB

let append s i = s + string i
"""
(set [| 0 |])
Set.empty
sourceFile
"Run.fsx"
"""
Expand All @@ -1122,7 +1122,7 @@ module ScriptModule =
let a = inc 41
append s a
"""
(set [| 1 |])
(set [| 0; 1 |])
sourceFile
"Independent.fs"
"""
Expand Down Expand Up @@ -1150,6 +1150,24 @@ let value = Script.ScriptModule.compute "hi"
"""
(set [| 2 |])
]
scenario
"Loaded script referenced by full path without open"
[
sourceFile
"A.fsx"
"""
let value = 41
"""
Set.empty
sourceFile
"B.fsx"
"""
#load "A.fsx"

let result = A.value + 1
"""
(set [| 0 |])
]
scenario
"Sub-namespace opens parent namespace with types and modules"
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ module ``module`` =
}
|]

// Dive into the anonymous module created for Program.fs
let trie = trie.Children["Program"]

Assert.Equal(1, trie.Children.Count)
Assert.True(trie.Children.ContainsKey("module"))

Expand Down
Loading