Ship FSharp.Core with a net10.0 target framework (#20229) · dotnet/fsharp@1928203 · GitHub
Skip to content

Commit 1928203

Browse files
authored
Ship FSharp.Core with a net10.0 target framework (#20229)
1 parent 7efd608 commit 1928203

29 files changed

Lines changed: 212 additions & 50 deletions

‎Directory.Build.props‎

Lines changed: 2 additions & 0 deletions

‎Directory.Build.targets‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
<NoWarn>$(NoWarn);NU1507</NoWarn>
1111
</PropertyGroup>
1212

13+
<!-- net10.0 ships in the FSharp.Core package only; in-repo .NET consumers keep binding netstandard2.1. -->
14+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(Configuration)' != 'Proto'">
15+
<ProjectReference Update="@(ProjectReference)">
16+
<SetTargetFramework Condition="'%(ProjectReference.Filename)' == 'FSharp.Core' and '%(ProjectReference.SetTargetFramework)' == ''">TargetFramework=netstandard2.1</SetTargetFramework>
17+
</ProjectReference>
18+
</ItemGroup>
19+
1320
<!-- Disable R2R when building source-only and not targeting the current SDK bundled TFM. -->
1421
<PropertyGroup>
1522
<PublishReadyToRun Condition="'$(DotNetBuildSourceOnly)' == 'true' and

‎azure-pipelines-PR.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,8 @@ stages:
562562
- script: .\Build.cmd -c Release -pack
563563
env:
564564
NativeToolsOnMachine: true
565+
- script: .\eng\common\dotnet.cmd fsi .\tests\AheadOfTime\NetPackage\VerifyNetPackage.fsx -- .\artifacts\packages\Release
566+
displayName: Verify FSharp.Core package assets
565567
- script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c Release
566568
displayName: End to end build tests
567569

‎docs/release-notes/.FSharp.Compiler.Service/11.0.100.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Fix internal compiler error FS1110 in `task { let! }` (and other computation expressions) when a generic IL extension method whose `this`-parameter is a method-level type variable is in scope (e.g. `open ReactiveUI`). Regression from PR #19536. ([Issue #19936](https://github.com/dotnet/fsharp/issues/19936))
3131
* Fix inner mutually-recursive `let rec ... and ...` functions under `--realsig+` not being lifted to top-level static methods (TLR), causing `FSharpFunc` closure allocations and loss of `tail.` opcodes — the large struct-mutual-recursion perf regression reported in [Issue #17607](https://github.com/dotnet/fsharp/issues/17607). ([PR #19882](https://github.com/dotnet/fsharp/pull/19882))
3232
* Fix `TypeLoadException` ("Specialize tried to implicitly override a method with weaker type parameter constraints") and the related CLR crash with constrained inline calls by stripping constraints from closure-class typars in `EraseClosures.convIlxClosureDef`. ([Issue #14492](https://github.com/dotnet/fsharp/issues/14492), [Issue #19075](https://github.com/dotnet/fsharp/issues/19075), [PR #19882](https://github.com/dotnet/fsharp/pull/19882))
33+
* Fix FS0073 during code generation when closure generic arguments contain an unsolved type variable. ([PR #20229](https://github.com/dotnet/fsharp/pull/20229))
3334
* Fix `FieldAccessException` at runtime when the optimizer relocates a read of a `protected` (family) base-class field into a method outside the field's family (e.g. a trivial member inlined into module/startup code under `--optimize+`). Protected (family) IL field access is no longer hoisted out of its declaring family by inlining or method-splitting. ([Issue #19963](https://github.com/dotnet/fsharp/issues/19963), [PR #19964](https://github.com/dotnet/fsharp/pull/19964))
3435

3536
* Suppress hover/symbol resolution for wildcard `_` patterns inside `member _.…` bodies that incorrectly showed `val _: T` tooltip. ([PR #19760](https://github.com/dotnet/fsharp/pull/19760))

‎docs/release-notes/.FSharp.Core/11.0.100.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
### Added
99

10+
* Ship `FSharp.Core` with an additional `net10.0` target framework (next to `netstandard2.0` and `netstandard2.1`). The `net`-TFM assembly is public-surface-identical to the `netstandard2.1` one; the target version is a pinned, deliberately advanced knob. ([PR #20229](https://github.com/dotnet/fsharp/pull/20229))
1011
* Add `Async.Await`, mirroring `Async.AwaitTask` semantics, but elides egregious `AggregateException` wrapping. Includes `ValueTask` support, and a SRTP-based overload accepting any Task-like value that supports the `GetAwaiter` protocol. ([Language Suggestion #840](https://github.com/fsharp/fslang-suggestions/issues/840), [PR #19785](https://github.com/dotnet/fsharp/pull/19785))
1112
* `Async.RunSynchronouslyImmediate`: runs work on the calling thread until the first asynchronous suspension (as opposed to `RunSynchronously`, which immediately offloads if not on a background and/or threadpool thread). ([Issue #1042](https://github.com/fsharp/fslang-suggestions/issues/1042), [PR #19804](https://github.com/dotnet/fsharp/pull/19804))
1213
* Added modules for `Async`, `Task` and `ValueTask` with consistent `result`, `map`, `bind`, `ignore`, `catchWith`, `catch`, and `empty` functions ([LanguageSuggestion #1466](https://github.com/fsharp/fslang-suggestions/issues/1466), [PR #19844](https://github.com/dotnet/fsharp/pull/19844))

‎eng/TargetFrameworks.props‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
<!-- Derive major version by stripping 'net' prefix and '.0' suffix (e.g., net10.0 -> 10) -->
1717
<FSharpNetCoreProductMajorVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1'))</FSharpNetCoreProductMajorVersion>
18+
19+
<!-- Net TFM shipped in the FSharp.Core NuGet package. Lags the in-dev product TFM; bump deliberately. -->
20+
<FSharpCoreShippedNetTargetFramework Condition="'$(FSharpCoreShippedNetTargetFramework)' == ''">net10.0</FSharpCoreShippedNetTargetFramework>
1821
</PropertyGroup>
1922

2023
</Project>

‎src/Compiler/CodeGen/IlxGen.fs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6833,7 +6833,7 @@ and GenSequenceExpr
68336833
let cloref = IlxClosureRef(ilCloTypeRef, ilCloLambdas, ilCloAllFreeVars)
68346834

68356835
let ilxCloSpec =
6836-
IlxClosureSpec.Create(cloref, GenGenericArgs m eenvouter.tyenv cloFreeTyvars, false)
6836+
IlxClosureSpec.Create(cloref, GenGenericArgs cenv m eenvouter.tyenv cloFreeTyvars, false)
68376837

68386838
let formalClospec =
68396839
IlxClosureSpec.Create(cloref, mkILFormalGenericArgs 0 ilCloGenericParams, false)
@@ -7075,8 +7075,10 @@ and GenStaticDelegateClosureTypeDefs
70757075
and GenGenericParams cenv eenv tps =
70767076
tps |> DropErasedTypars |> List.map (GenGenericParam cenv eenv)
70777077

7078-
and GenGenericArgs m (tyenv: TypeReprEnv) tps =
7079-
tps |> DropErasedTypars |> List.map (fun c -> (mkILTyvarTy tyenv[c, m]))
7078+
and GenGenericArgs cenv m (tyenv: TypeReprEnv) tps =
7079+
tps
7080+
|> DropErasedTypars
7081+
|> List.map (fun tp -> GenType cenv m tyenv (mkTyparTy tp))
70807082

70817083
/// Generate a local type function contract class and implementation
70827084
and GenClosureAsLocalTypeFunction cenv (cgbuf: CodeGenBuffer) eenv thisVars expr m =
@@ -7476,7 +7478,7 @@ and GetIlxClosureInfo cenv m boxity isLocalTypeFunc canUseStaticField thisVars e
74767478

74777479
/// Compute the contract if it is a local type function
74787480
let ilCloGenericFormals = GenGenericParams cenv eenvinner cloFreeTyvars
7479-
let ilCloGenericActuals = GenGenericArgs m eenvouter.tyenv cloFreeTyvars
7481+
let ilCloGenericActuals = GenGenericArgs cenv m eenvouter.tyenv cloFreeTyvars
74807482

74817483
let useStaticField = canUseStaticField && (ilCloAllFreeVars.Length = 0)
74827484

@@ -7784,7 +7786,7 @@ and GenDelegateExpr cenv cgbuf eenvouter expr (TObjExprMethod(slotsig, _attribs,
77847786
CountClosure()
77857787

77867788
// Push the constructor for the delegee
7787-
let ctxtGenericArgsForDelegee = GenGenericArgs m eenvouter.tyenv cloFreeTyvars
7789+
let ctxtGenericArgsForDelegee = GenGenericArgs cenv m eenvouter.tyenv cloFreeTyvars
77887790

77897791
if useStaticClosure then
77907792
GenUnit cenv eenvouter m cgbuf

‎src/FSharp.Core/FSharp.Core.fsproj‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<PropertyGroup>
66
<OutputType>Library</OutputType>
77
<TargetFrameworks Condition="'$(Configuration)' == 'Proto'">netstandard2.0</TargetFrameworks>
8-
<TargetFrameworks Condition="'$(Configuration)' != 'Proto'">netstandard2.0;netstandard2.1</TargetFrameworks>
8+
<TargetFrameworks Condition="'$(Configuration)' != 'Proto'">netstandard2.0;netstandard2.1;$(FSharpCoreShippedNetTargetFramework)</TargetFrameworks>
99
<NoWarn>$(NoWarn);75</NoWarn> <!-- InternalCommandLineOption -->
1010
<NoWarn>$(NoWarn);1204</NoWarn> <!-- This construct is for use in the FSharp.Core library and should not be used directly -->
1111
<AllowCrossTargeting>true</AllowCrossTargeting>
@@ -36,6 +36,11 @@
3636
<Configurations>Debug;Release;Proto</Configurations>
3737
</PropertyGroup>
3838

39+
<!-- Surface the shipped-net pin to FSharp.Core.nuspec as a $token$. -->
40+
<ItemGroup Condition="'$(Configuration)' != 'Proto'">
41+
<NuspecProperty Include="FSharpCoreShippedNetTargetFramework=$(FSharpCoreShippedNetTargetFramework)" />
42+
</ItemGroup>
43+
3944
<!-- .FSharp.Core always uses the old style initialization mechanism because of SQL CLR requirements -->
4045
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'true' and '$(Configuration)' != 'Proto'">
4146
<OtherFlags>$(OtherFlags) --realsig-</OtherFlags>

‎src/FSharp.Core/FSharp.Core.nuspec‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<dependencies>
77
<group targetFramework=".NETStandard2.0" />
88
<group targetFramework=".NETStandard2.1" />
9+
<group targetFramework="$FSharpCoreShippedNetTargetFramework$" />
910
</dependencies>
1011
</metadata>
1112
<files>
@@ -22,5 +23,11 @@
2223

2324
<!-- resources -->
2425
<file src="FSharp.Core\$Configuration$\netstandard2.1\**\FSharp.Core.resources.dll" target="lib\netstandard2.1" />
26+
27+
<file src="FSharp.Core\$Configuration$\$FSharpCoreShippedNetTargetFramework$\FSharp.Core.dll" target="lib\$FSharpCoreShippedNetTargetFramework$" />
28+
<file src="FSharp.Core\$Configuration$\$FSharpCoreShippedNetTargetFramework$\FSharp.Core.xml" target="lib\$FSharpCoreShippedNetTargetFramework$" />
29+
30+
<!-- resources -->
31+
<file src="FSharp.Core\$Configuration$\$FSharpCoreShippedNetTargetFramework$\**\FSharp.Core.resources.dll" target="lib\$FSharpCoreShippedNetTargetFramework$" />
2532
</files>
2633
</package>

‎src/FSharp.Core/Query.fs‎

Lines changed: 7 additions & 7 deletions

0 commit comments

Comments
 (0)