You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix spurious type errors for provided types under parallel compilation (#19969)
* Fix spurious type errors for provided types under parallel compilation
Intern provided-type entities by name so the same provided type linked from
multiple files under graph-based parallel checking yields one entity, avoiding
spurious FS0001 type mismatches from identity comparisons.
Capture the systemRuntimeContainsType closure stably so TypeProviders-SDK
providers load under an unoptimized compiler (the SDK reflects on a field
named tcImports whose name was previously codegen-dependent).
Co-authored-by: Copilot <[email protected]>
* Add release notes for type-provider parallel-checking and SDK hosting fixes
Co-authored-by: Copilot <[email protected]>
* Retrigger CI: IcedTasks_Test_Debug flaky timeout (agent OOM, net9.0 testhost hang)
All 47 jobs passed except IcedTasks_Test_Debug, which timed out at 120min after all
but one test target completed. The identical suite passed in IcedTasks_Test_Release (8m)
and IcedTasks does not use type providers, so this PR's type-provider-only changes
cannot affect its build or test runtime. The CI agent reported 95% memory usage and
one net9.0 testhost hung. Re-running to clear the transient failure.
Co-authored-by: Copilot <[email protected]>
* Address review feedback: harden provided-type cache coherence, strengthen guard test, document embedding path
- TypedTree.fs: serialize the four lookup caches AddProvidedTypeEntity invalidates against concurrent provided-type interning via a lazily-created lock gated on a volatile hostsProvidedTypes flag (cacheOptByrefWithLock), so non-type-provider modules keep the lock-free fast path. Replaces the CAS append with a lock-guarded append+invalidate, closing the read-compute-store vs invalidation race.
- lib.fs/lib.fsi: add cacheOptByrefWithLock inline helper.
- ManglingNameOfProvidedTypes.fs: strengthen the systemRuntimeContainsType guard test (also assert no synthesized 'objectArg' receiver capture) and document/verify it in Debug and Release; add a concurrency stress test for cache coherence under interning.
- CheckDeclarations.fs: comment confirming the embedding path builds a fresh local module disjoint from interned provided-type modules.
Co-authored-by: Copilot <[email protected]>
* Make provided-type lookup caches lock-free via entity version stamping
Replace the lock-based coherence scheme for ModuleOrNamespaceType's
provided-type-mutated lookup tables with a lock-free version-stamped
approach. 'entitiesVersion' is bumped (release) whenever 'entities' is
appended to, and each cached lookup table is tagged with the version it
was built from, so a reader on another graph-based-checking thread
recomputes after a concurrent provided-type append instead of trusting
a stale memo.
- lib: replace 'cacheOptByrefWithLock' with 'cacheOptByrefByVersion'.
- TypedTree: drop 'providedTypeCacheLock'/'hostsProvidedTypes' and the
'ProvidedTypeCacheGate'; 'AddProvidedTypeEntity' now appends via a CAS
loop and bumps 'entitiesVersion' last; the version-stamped caches need
no explicit invalidation.
- Tests: exercise all four version-stamped lookup tables with more
concurrent readers.
Co-authored-by: Copilot <[email protected]>
* Bound the provided-type cache-coherence stress test for CI
The concurrency guard spun 32 hot reader threads against 100 writers over
20 iterations, continuously rebuilding the version-stamped lookup tables
under Server GC. That pegs CPU and piles up allocations on memory-limited
CI agents. Reduce to 6 cooperative (yielding) readers and 40 writers over
5 iterations: still interleaves many version bumps with concurrent reads to
guard the coherence invariant, without the resource spike.
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copy file name to clipboardExpand all lines: docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
### Fixed
2
2
3
+
* Provided types used from multiple files no longer produce spurious FS0001 type mismatches under parallel compilation; provided-type entities are now interned so every file linking a given provided type shares one entity. ([PR #19969](https://github.com/dotnet/fsharp/pull/19969))
4
+
* TypeProviders-SDK providers now load under an unoptimized compiler; the `systemRuntimeContainsType` closure field the SDK reflects on (`tcImports`) is captured stably regardless of optimization settings. ([PR #19969](https://github.com/dotnet/fsharp/pull/19969))
3
5
* Fixed: Inheriting from an undefined type now reports `FS0039` exactly once instead of three times. Phase 1F and Phase 2A of inherit-clause type-checking now skip re-resolving a syntactic clause whose Phase 1D resolution already failed with `UndefinedName`, eliminating both the duplicate diagnostic and the redundant work. ([Issue #16432](https://github.com/dotnet/fsharp/issues/16432), [PR #19862](https://github.com/dotnet/fsharp/pull/19862))
4
6
* Fix several F# editor semantic-classification errors: F# delegate declarations no longer highlight the `delegate of …` syntax as a method, computation-expression builders inside list/array comprehensions are classified as `ComputationExpression`, the closing `]` of an open-ended slice (e.g. `xs[0..]`) is no longer classified as `Function`/`Method`, and `open type T` is no longer reported as unused when its imported members (static members, static fields, or DU union cases) are used. ([Issue #19905](https://github.com/dotnet/fsharp/issues/19905), [PR #19960](https://github.com/dotnet/fsharp/pull/19960))
5
7
* Diagnostic FS0027 now emits a parameter-specific message (suggesting a `let mutable x = x` shadow or `byref<_>`) instead of the illegal `let mutable x = expression` shadow when the assignment target is a function or method parameter. ([Issue #15803](https://github.com/dotnet/fsharp/issues/15803), [PR #19866](https://github.com/dotnet/fsharp/pull/19866))
0 commit comments