Skip to content
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

Merge main to release/dev17.10 #16818

Merged
merged 8 commits into from
Mar 7, 2024
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
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ stages:
condition: always()

# Test trimming on Windows
- job: Build_And_Test_Trimming_Windows
- job: Build_And_Test_AOT_Windows
pool:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals $(WindowsMachineQueueName)
Expand Down Expand Up @@ -825,9 +825,9 @@ stages:
env:
NativeToolsOnMachine: true
displayName: Initial build and prepare packages.
- script: $(Build.SourcesDirectory)/tests/AheadOfTime/Trimming/check.cmd
- script: $(Build.SourcesDirectory)/tests/AheadOfTime/check.cmd
displayName: Build, trim, publish and check the state of the trimmed app.
workingDirectory: $(Build.SourcesDirectory)/tests/AheadOfTime/Trimming
workingDirectory: $(Build.SourcesDirectory)/tests/AheadOfTime
- task: PublishPipelineArtifact@1
displayName: Publish Trim Tests Logs
inputs:
Expand Down
326 changes: 326 additions & 0 deletions docs/optimizations-equality.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Fix release inline optimization, which leads to MethodAccessException if used with `assembly:InternalsVisibleTo`` attribute. ([Issue #16105](https://github.com/dotnet/fsharp/issues/16105), ([PR #16737](https://github.com/dotnet/fsharp/pull/16737))
* Enforce AttributeTargets on let values and functions. ([PR #16692](https://github.com/dotnet/fsharp/pull/16692))
* Enforce AttributeTargets on union case declarations. ([PR #16764](https://github.com/dotnet/fsharp/pull/16764))
* Disallow using base to invoke an abstract base method. ([Issue #13926](https://github.com/dotnet/fsharp/issues/13926), [PR #16773](https://github.com/dotnet/fsharp/pull/16773))

### Added

Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Core/8.0.300.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Added

* Minor tweaks to inline specifications to support Visibility PR ([PR #15484](https://github.com/dotnet/fsharp/pull/15484), [#PR 16427](https://github.com/dotnet/fsharp/pull/15484)
* Optimize equality in generic contexts. ([PR #16615](https://github.com/dotnet/fsharp/pull/16615))

### Fixed

* Preserve original stack traces in resumable state machines generated code if available. ([PR #16568](https://github.com/dotnet/fsharp/pull/16568))
8 changes: 6 additions & 2 deletions docs/release-notes/.Language/8.0.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Added
### Fixed

* `while!` ([Language suggestion #1038](https://github.com/fsharp/fslang-suggestions/issues/1038), [PR #14238](https://github.com/dotnet/fsharp/pull/14238))
* Disallow using base to invoke an abstract base method ([Issue #13926](https://github.com/dotnet/fsharp/issues/13926), [PR #16773](https://github.com/dotnet/fsharp/pull/16773))

### Added

* `while!` ([Language suggestion #1038](https://github.com/fsharp/fslang-suggestions/issues/1038), [PR #14238](https://github.com/dotnet/fsharp/pull/14238))
2 changes: 1 addition & 1 deletion eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ try {
}

if ($testAOT) {
Push-Location "$RepoRoot\tests\AheadOfTime\Trimming"
Push-Location "$RepoRoot\tests\AheadOfTime"
./check.cmd
Pop-Location
}
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24127.3">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24154.2">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>d1c092f24a18f5ed76631fc6c865f706aca5d90f</Sha>
<Sha>936b4a4b4b8a74b65098983660c5814fb4afee15</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand Down
6 changes: 2 additions & 4 deletions src/Compiler/AbstractIL/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5640,10 +5640,8 @@ let resolveILMethodRefWithRescope r (td: ILTypeDef) (mref: ILMethodRef) =
possibles
|> List.filter (fun md ->
mref.CallingConv = md.CallingConv
&&
// REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct
(md.Parameters, argTypes)
||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2)
&& (md.Parameters, argTypes)
||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2)
&&
// REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct
r md.Return.Type = retType)
Expand Down
25 changes: 17 additions & 8 deletions src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,6 @@ module TcRecdUnionAndEnumDeclarations =

let TcUnionCaseDecl (cenv: cenv) env parent thisTy thisTyInst tpenv hasRQAAttribute (SynUnionCase(Attributes synAttrs, SynIdent(id, _), args, xmldoc, vis, m, _)) =
let g = cenv.g
let attrs =
// The attributes of a union case decl get attached to the generated "static factory" method
// Enforce that the union-cases can only be targeted by attributes with AttributeTargets.Method
if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations) then
TcAttributes cenv env AttributeTargets.Method synAttrs
else
TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs

let vis, _ = ComputeAccessAndCompPath g env None m vis None parent
let vis = CombineReprAccess parent vis

Expand Down Expand Up @@ -571,6 +563,23 @@ module TcRecdUnionAndEnumDeclarations =

let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some names)
let attrs =
(*
The attributes of a union case decl get attached to the generated "static factory" method.
Enforce union-cases AttributeTargets:
- AttributeTargets.Method
type SomeUnion =
| Case1 of int // Compiles down to a static method
- AttributeTargets.Property
type SomeUnion =
| Case1 // Compiles down to a static property
*)
if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations) then
let target = if rfields.IsEmpty then AttributeTargets.Property else AttributeTargets.Method
TcAttributes cenv env target synAttrs
else
TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs

Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis

let TcUnionCaseDecls (cenv: cenv) env (parent: ParentRef) (thisTy: TType) (thisTyInst: TypeInst) hasRQAAttribute tpenv unionCases =
Expand Down
12 changes: 6 additions & 6 deletions src/Compiler/Checking/PostInferenceChecks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1307,14 +1307,14 @@ and CheckILBaseCall cenv env (ilMethRef, enclTypeInst, methInst, retTypes, tyarg
match tryTcrefOfAppTy g baseVal.Type with
| ValueSome tcref when tcref.IsILTycon ->
try
// This is awkward - we have to explicitly re-resolve back to the IL metadata to determine if the method is abstract.
// We believe this may be fragile in some situations, since we are using the Abstract IL code to compare
// type equality, and it would be much better to remove any F# dependency on that implementation of IL type
// equality. It would be better to make this check in tc.fs when we have the Abstract IL metadata for the method to hand.
let mdef = resolveILMethodRef tcref.ILTyconRawMetadata ilMethRef
let mdef =
match tcref.ILTyconInfo with
| TILObjectReprData(scoref, _, _) ->
resolveILMethodRefWithRescope (rescopeILType scoref) tcref.ILTyconRawMetadata ilMethRef

if mdef.IsAbstract then
errorR(Error(FSComp.SR.tcCannotCallAbstractBaseMember(mdef.Name), m))
with _ -> () // defensive coding
with _ -> ()
| _ -> ()

CheckTypeInstNoByrefs cenv env m tyargs
Expand Down
20 changes: 10 additions & 10 deletions src/Compiler/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<InternalsVisibleTo Include="LanguageServiceProfiling" />
<InternalsVisibleTo Include="FSharp.Compiler.Benchmarks" />
<InternalsVisibleTo Include="HistoricalBenchmark" />
<InternalsVisibleTo Include="FSharp.Test.Utilities" />
<InternalsVisibleTo Include="FSharp.Editor" />
<InternalsVisibleTo Include="FSharp.Test.Utilities" />
<InternalsVisibleTo Include="FSharp.Editor" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -365,8 +365,8 @@
<Compile Include="Checking\CheckIncrementalClasses.fs" />
<Compile Include="Checking\CheckDeclarations.fsi" />
<Compile Include="Checking\CheckDeclarations.fs" />
<Compile Include="Checking\SignatureHash.fsi" />
<Compile Include="Checking\SignatureHash.fs" />
<Compile Include="Checking\SignatureHash.fsi" />
<Compile Include="Checking\SignatureHash.fs" />
<Compile Include="Optimize\Optimizer.fsi" />
<Compile Include="Optimize\Optimizer.fs" />
<Compile Include="Optimize\DetupleArgs.fsi" />
Expand Down Expand Up @@ -504,12 +504,12 @@
<Compile Include="Service\QuickParse.fsi" />
<Compile Include="Service\QuickParse.fs" />
<Compile Include="Service\FSharpCheckerResults.fsi" />
<Compile Include="Service\FSharpCheckerResults.fs" />
<Compile Include="Service\FSharpProjectSnapshot.fs" />
<Compile Include="Service\BackgroundCompiler.fsi" />
<Compile Include="Service\BackgroundCompiler.fs" />
<Compile Include="Service\TransparentCompiler.fsi" />
<Compile Include="Service\TransparentCompiler.fs" />
<Compile Include="Service\FSharpCheckerResults.fs" />
<Compile Include="Service\FSharpProjectSnapshot.fs" />
<Compile Include="Service\BackgroundCompiler.fsi" />
<Compile Include="Service\BackgroundCompiler.fs" />
<Compile Include="Service\TransparentCompiler.fsi" />
<Compile Include="Service\TransparentCompiler.fs" />
<Compile Include="Service\service.fsi" />
<Compile Include="Service\service.fs" />
<Compile Include="Service\ServiceInterfaceStubGenerator.fsi" />
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Core/FSharp.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<OtherFlags>$(OtherFlags) --nowarn:3513</OtherFlags>
<OtherFlags>$(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1</OtherFlags>
<!-- .FSharp.Core always uses the old style initialization mechanism because of SQL CLR requirements -->
<OtherFlags Condition="'$(Configuration)' != 'Proto'">$(OtherFlags) --realsig-</OtherFlags>
<OtherFlags Condition="'$(BUILDING_USING_DOTNET)' != 'true' and '$(Configuration)' != 'Proto'">$(OtherFlags) --realsig-</OtherFlags>
<!-- .tail annotations always emitted for this binary, even in debug mode -->
<Tailcalls>true</Tailcalls>
<NGenBinary>true</NGenBinary>
Expand Down
Loading
Loading