Skip to content

Old IncrementalBuilder: Fix cancellation token not passed to tcExtras #18279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
20 changes: 8 additions & 12 deletions src/Compiler/Service/IncrementalBuild.fs
Original file line number Diff line number Diff line change
@@ -316,12 +316,6 @@ type BoundModel private (
})
| _ -> None

let getTcInfo (typeCheck: GraphNode<TypeCheck>) =
async {
let! tcInfo , _, _, _, _ = typeCheck.GetOrComputeValue()
return tcInfo
} |> GraphNode

let getTcInfoExtras (typeCheck: GraphNode<TypeCheck>) =
async {
let! _ , sink, implFile, fileName, _ = typeCheck.GetOrComputeValue()
@@ -370,11 +364,15 @@ type BoundModel private (
return diags
} |> GraphNode

let startComputingFullTypeCheck =
let getTcInfo (typeCheck: GraphNode<TypeCheck>) =
async {
let! _ = tcInfoExtras.GetOrComputeValue()
return! diagnostics.GetOrComputeValue()
}
let! ct = Async.CancellationToken
if not tcInfoExtras.HasValue then
// start computing extras, so that typeCheckNode can be GC'd quickly
Async.Start (tcInfoExtras.GetOrComputeValue() |> Async.Catch |> Async.Ignore, ct)
let! tcInfo , _, _, _, _ = typeCheck.GetOrComputeValue()
return tcInfo
} |> GraphNode

let tcInfo, tcInfoExtras =
match tcStateOpt with
@@ -385,8 +383,6 @@ type BoundModel private (
// For skipped implementation sources do full type check only when requested.
GraphNode.FromResult tcInfo, tcInfoExtras
| _ ->
// start computing extras, so that typeCheckNode can be GC'd quickly
startComputingFullTypeCheck |> Async.Catch |> Async.Ignore |> Async.Start
getTcInfo typeCheckNode, tcInfoExtras

member val Diagnostics = diagnostics