Skip to content

Commit

Permalink
Merge branch 'main' into snapshot-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vzarytovskii authored Sep 16, 2024
2 parents 3aa9db8 + f4860a4 commit 1a8e11c
Show file tree
Hide file tree
Showing 2,829 changed files with 57,891 additions and 24,583 deletions.
12 changes: 6 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
{
"name": "F#",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.3",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-rc.1",
"features": {
"ghcr.io/devcontainers/features/common-utils:2.4.2": {},
"ghcr.io/devcontainers/features/git:1.2.0": {},
"ghcr.io/devcontainers/features/github-cli:1.0.11": {},
"ghcr.io/devcontainers/features/dotnet:2.0.5": {}
"ghcr.io/devcontainers/features/common-utils:2.5.1": {},
"ghcr.io/devcontainers/features/git:1.3.2": {},
"ghcr.io/devcontainers/features/github-cli:1.0.13": {},
"ghcr.io/devcontainers/features/dotnet:2.1.3": {}
},
"hostRequirements": {
"cpus": 2,
Expand All @@ -28,7 +28,7 @@
}
},
"remoteEnv": {
"TARGET": "net8.0"
"TARGET": "net9.0"
},
"postCreateCommand": [ "dotnet", "build", "FSharp.Compiler.Service.sln"]
}
33 changes: 31 additions & 2 deletions .fantomasignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vsintegration/*
!vsintegration/tests/FSharp.Editor.Tests
artifacts/

# For some reason, it tries to format files from remotes (Processing .\.git\refs\remotes\<remote>\FSComp.fsi)
# For some reason, it tries to format files from remotes (Processing ./.git/refs/remotes/<remote>/FSComp.fsi)
.git/

# Explicitly unformatted implementation
Expand All @@ -21,7 +21,7 @@ src/Compiler/Checking/AttributeChecking.fs
src/Compiler/Checking/AugmentWithHashCompare.fs
src/Compiler/Checking/CheckBasics.fs
src/Compiler/Checking/CheckDeclarations.fs
src/Compiler/Checking/CheckExpressions.fs
src/Compiler/Checking/Expressions/CheckExpressions.fs
src/Compiler/Checking/CheckFormatStrings.fs
src/Compiler/Checking/CheckIncrementalClasses.fs
src/Compiler/Checking/CheckPatterns.fs
Expand Down Expand Up @@ -88,6 +88,35 @@ src/FSharp.Core/Query.fs
src/FSharp.Core/seqcore.fs


# fsharp (to investigate)

**/TypeProviders.fsi
**/tainted.fsi

# uses nullness features

**/DependencyProvider.fsi
src/FSharp.Core/array.fs
src/FSharp.Core/option.fsi
src/FSharp.Core/option.fs
src/fsi/console.fs
src/FSharp.Build/FSharpCommandLineBuilder.fs

src/Compiler/Utilities/Activity.fs
src/Compiler/Utilities/sformat.fs
src/Compiler/Utilities/illib.fsi
src/Compiler/Utilities/illib.fs


src/Compiler/Utilities/NullnessShims.fs
src/Compiler/Utilities/LruCache.fsi
src/Compiler/Utilities/LruCache.fs
src/Compiler/Utilities/HashMultiMap.fsi
src/Compiler/Utilities/HashMultiMap.fs
src/Compiler/Facilities/AsyncMemoize.fsi
src/Compiler/Facilities/AsyncMemoize.fs
src/Compiler/AbstractIL/il.fs

# Fantomas limitations on implementation files (to investigate)

src/Compiler/AbstractIL/ilwrite.fs
Expand Down
9 changes: 8 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Because this repository uses squash/rebase merges, commits added to a branch
# referencing earlier commits in the same branch and squash/rebased merged as part of a PR
# will need to be rewritten in a subsequent PR to the corresponding squashed/rebased commit SHAs.

# Format src/Compiler/Checking/CheckComputationExpressions.fs, https://github.com/dotnet/fsharp/pull/16512
603a310cdfd9902ec1d29b399377dcc9ac56235b
0318afd91f38533879cc89d598e0431c312ad57e

# Spelling, https://github.com/dotnet/fsharp/pull/16212
23e91e1322363a7e9c34baaeabbf0391c4b7eafd
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/nullness_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Nullness-related report
title: 'Nullness issue - ....'
description: Create a report related to nullable reference types handling
labels: [Bug, Needs-Triage,Area-Nullness]
assignees: 'T-Gro'
body:
- type: textarea
attributes:
label: Issue description
description: A concise description of what you're experiencing.
validations:
required: true
- type: markdown
attributes:
value: |
Please check at [Nullable Reference Types RFC](https://github.com/fsharp/fslang-design/blob/main/RFCs/FS-1060-nullable-reference-types.md) if this issue isn't a known limitation, such as missing flow-control analysis after branching constructs like `if` or `while`. Also check at [existing nullness issues](https://github.com/dotnet/fsharp/issues?q=is%3Aissue+label%3AArea-Nullness+) if it hasn't been reported already.
Please provide a succinct description of the issue and choose 1 or more from the following categories of impact
- type: checkboxes
id: categories
attributes:
label: Choose one or more from the following categories of impact
options:
- label: Unexpected nullness warning (false positive in nullness checking, code uses --checknulls and langversion:preview).
- label: Missing nullness warning in a case which can produce nulls (false negative, code uses --checknulls and langversion:preview).
- label: Breaking change related to older `null` constructs in code not using the checknulls switch.
- label: Breaking change related to generic code and explicit type constraints (`null`, `not null`).
- label: Type inference issue (i.e. code worked without type annotations before, and applying the --checknulls enforces type annotations).
- label: C#/F# interop issue related to nullness metadata.
- label: Other (none of the categories above apply).
validations:
required: true
- type: dropdown
id: os
attributes:
label: Operating System
description: What operating system are you running?
options:
- Windows (Default)
- Linux
- macOS
default: 0
validations:
required: true
- type: dropdown
id: dotnet-kind
attributes:
label: What .NET runtime/SDK kind are you seeing the issue on
multiple: false
options:
- .NET SDK (.NET Core, .NET 5+)
- .NET Framework
default: 0
validations:
required: true
- type: input
id: dotnet-version
attributes:
label: .NET Runtime/SDK version
placeholder: e.g. .NET 9 or .NET SDK 9.0.100
- type: textarea
attributes:
label: Reproducible code snippet and actual behavior
description: |
Provide a small code snippet demonstrating the issue. |
If referenced code is needed for the repro and cannot be shared (e.g. a private C# nuget package), try to share at least the metadata annotations from the called type+member as seen in `ilspy.exe`. C# compiler produces attributes like `[Nullable]` and `[NullableContext]`, which is what F# compiler tries to load and interpret in C#/F# interop scenarios.
placeholder: Code snippet
validations:
required: false
- type: textarea
attributes:
label: Possible workarounds
description: |
Are there any language constructs (typically pattern matching, library constructs, Null/NonNull active patterns, explicit type annotations) allowing the same logic be expressed differently in order to mitigate the experienced nullness issue?
placeholder: Possible workaround
validations:
required: false
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Fixes # (issue, if applicable)
>
> Release notes files:
> - If anything under `src/Compiler` has been changed, please make sure to make an entry in `docs/release-notes/.FSharp.Compiler.Service/<version>.md`, where `<version>` is usually "highest" one, e.g. `42.8.200`
> - If language feature was added (i.e. `LanguageFeatures.fsi` was changed), please add it to `docs/releae-notes/.Language/preview.md`
> - If language feature was added (i.e. `LanguageFeatures.fsi` was changed), please add it to `docs/release-notes/.Language/preview.md`
> - If a change to `FSharp.Core` was made, please make sure to edit `docs/release-notes/.FSharp.Core/<version>.md` where version is "highest" one, e.g. `8.0.200`.
> Information about the release notes entries format can be found in the [documentation](https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html).
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ nCrunchTemp_*
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual
*.vsp
/tests/AheadOfTime/Trimming/output.txt
*.svclog
micro.exe
positive.exe
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// TODO: Shall we assume that it's already been built, or build it every time we debug?
"preLaunchTask": "${defaultBuildTask}",
// If you have changed target frameworks, make sure to update the program p
"program": "${workspaceFolder}/artifacts/bin/fsi/Debug/net8.0/fsi.dll",
"program": "${workspaceFolder}/artifacts/bin/fsi/Debug/net9.0/fsi.dll",
"args": [
"${input:fsiArgsPrompt}"
],
Expand Down Expand Up @@ -53,7 +53,7 @@
// TODO: Shall we assume that it's already been built, or build it every time we debug?
"preLaunchTask": "${defaultBuildTask}",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/artifacts/bin/fsc/Debug/net8.0/fsc.dll",
"program": "${workspaceFolder}/artifacts/bin/fsc/Debug/net9.0/fsc.dll",
"args": [
"--targetprofile:netstandard",
"--simpleresolution",
Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"Speedscope",
"--",
"dotnet",
"${workspaceFolder}/artifacts/bin/fsi/Debug/net8.0/fsi.dll",
"${workspaceFolder}/artifacts/bin/fsi/Debug/net9.0/fsi.dll",
"${input:fsiArgsPrompt}"
],
"problemMatcher": "$msCompile",
Expand All @@ -118,7 +118,7 @@
"Speedscope",
"--",
"dotnet",
"${workspaceFolder}/artifacts/bin/fsc/Debug/net8.0/fsc.dll",
"${workspaceFolder}/artifacts/bin/fsc/Debug/net9.0/fsc.dll",
"--targetprofile:netstandard",
"--simpleresolution",
"${input:fscArgsPrompt}"
Expand Down
15 changes: 13 additions & 2 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ To use your custom build of `Fsc`, add the `DotnetFscCompilerPath` property to y

```xml
<PropertyGroup>
<DotnetFscCompilerPath>D:\Git\fsharp\artifacts\bin\fsc\Debug\net8.0\fsc.dll</DotnetFscCompilerPath>
<DotnetFscCompilerPath>D:\Git\fsharp\artifacts\bin\fsc\Debug\net9.0\fsc.dll</DotnetFscCompilerPath>
</PropertyGroup>
```

Expand Down Expand Up @@ -215,6 +215,17 @@ or
> **Note**
> Please note, that by default, **Release** version of IL baseline tests will be running in CI, so when updating baseline (.bsl) files, make sure to add `-c Release` flag to the build command.

### Updating FCS surface area baselines

```bash
$env:TEST_UPDATE_BSL=1
dotnet test tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --filter "SurfaceAreaTest" /p:BUILDING_USING_DOTNET=true
dotnet test tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --filter "SurfaceAreaTest" /p:BUILDING_USING_DOTNET=true
dotnet test tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --filter "SurfaceAreaTest" -c Release /p:BUILDING_USING_DOTNET=true
dotnet test tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --filter "SurfaceAreaTest" -c Release /p:BUILDING_USING_DOTNET=true
```

## Automated Source Code Formatting

Some of the code in this repository is formatted automatically by [Fantomas](https://github.com/fsprojects/fantomas). To format all files use:
Expand Down Expand Up @@ -331,4 +342,4 @@ See the "Debugging The Compiler" section of this [article](https://medium.com/@w

If you are behind a proxy server, NuGet client tool must be configured to use it:

See the Nuget config file documention for use with a proxy server [https://learn.microsoft.com/nuget/reference/nuget-config-file](https://learn.microsoft.com/nuget/reference/nuget-config-file)
See the Nuget config file documentation for use with a proxy server [https://learn.microsoft.com/nuget/reference/nuget-config-file](https://learn.microsoft.com/nuget/reference/nuget-config-file)
11 changes: 8 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<FSharpNetCoreProductDefaultTargetFramework>net8.0</FSharpNetCoreProductDefaultTargetFramework>
<FSharpNetCoreProductDefaultTargetFramework>net9.0</FSharpNetCoreProductDefaultTargetFramework>
<IgnoreMibc Condition="'$(IgnoreMibc)' == ''">$(DotNetBuildFromSource)</IgnoreMibc>
</PropertyGroup>

<!--
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local FSharp.Core project.
We also disable arcade and reset certain artifacts and compiler paths to use default ones.
All settings below can be overriden via CLI switches if needed. -->
All settings below can be overridden via CLI switches if needed. -->

<PropertyGroup Condition="'$(SolutionName)' == 'FSharp.Compiler.Service' and '$(BUILDING_USING_DOTNET)' != 'false'">
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
Expand Down Expand Up @@ -45,7 +46,10 @@

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">true</FSHARPCORE_USE_PACKAGE>

<!-- TODO(vlza): This probably should be `true` once fslib with nullness ships, since shipped library is preferred by default when building this solution. -->
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">false</FSHARPCORE_USE_PACKAGE>

<DISABLE_ARCADE Condition="'$(DISABLE_ARCADE)' == ''">true</DISABLE_ARCADE>
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts/</ArtifactsDir>
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
Expand All @@ -56,6 +60,7 @@
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />

<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
Expand Down
14 changes: 14 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,18 @@
</KnownCrossgen2Pack>
</ItemGroup>

<!-- We want to restore ALL the MIBCs when we build anything, since in the future it will contain different profiles, not only the FSC one we got from building Giraffe -->
<Import Project="$(MSBuildThisFileDirectory)\eng\restore\optimizationData.targets"/>
<ItemGroup>
<PackageReference Include="@(MIBCPackage)" />
</ItemGroup>

<Target Name="CopyMIBCWrapper" AfterTargets="Restore" BeforeTargets="Build;Pack">
<MSBuild
Projects="$(MSBuildThisFileDirectory)eng\restore\optimizationData.targets"
Properties="ArtifactsDir=$(MSBuildThisFileDirectory)artifacts\;NuGetPackageRoot=$(NuGetPackageRoot);MibcFiles=$(MibcFiles);optimizationwindows_ntx86MIBCRuntimeVersion=$(optimizationwindows_ntx86MIBCRuntimeVersion);optimizationwindows_ntx64MIBCRuntimeVersion=$(optimizationwindows_ntx64MIBCRuntimeVersion);optimizationwindows_ntarm64MIBCRuntimeVersion=$(optimizationwindows_ntarm64MIBCRuntimeVersion);optimizationlinuxx64MIBCRuntimeVersion=$(optimizationlinuxx64MIBCRuntimeVersion);optimizationlinuxarm64MIBCRuntimeVersion=$(optimizationlinuxarm64MIBCRuntimeVersion)"
Targets="CopyMIBC"
RemoveProperties="TargetFramework"
StopOnFirstFailure="True" />
</Target>
</Project>
3 changes: 1 addition & 2 deletions FSharp.Benchmarks.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32113.165
MinimumVisualStudioVersion = 10.0.40219.1
Expand Down
34 changes: 34 additions & 0 deletions FSharp.Profiles.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project>
<PropertyGroup>
<!-- This turns on/off the use of the feature within the codebase -->
<!-- The default is off - it is selectively enabled -->
<CheckNulls Condition="'$(CheckNulls)' == ''">false</CheckNulls>
</PropertyGroup>

<PropertyGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">
<!-- nullness checking isn't possible when using shipped FSharp.Core package until it's updated -->
<CheckNulls>false</CheckNulls>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
<CheckNulls>false</CheckNulls>
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
<NullCheckingSupportInLibrary>false</NullCheckingSupportInLibrary>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' != 'Proto' and '$(BUILDING_USING_DOTNET)' != 'true'">
<OtherFlags>$(OtherFlags) /langversion:preview</OtherFlags>
</PropertyGroup>

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<CheckNulls>false</CheckNulls>
</PropertyGroup>

<PropertyGroup Condition="'$(CheckNulls)' == 'true'">
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(CheckNulls)' == 'false'">
<!-- 3271: warning nullness annotations being ignored -->
<NoWarn>$(NoWarn);3271</NoWarn>
<DefineConstants>NO_CHECKNULLS;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Choose>
<When Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
Expand Down
3 changes: 1 addition & 2 deletions FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@

<!-- localization -->
<PropertyGroup>
<EnableXlfLocalization Condition="'$(EnableXlfLocalization)' == '' AND ('$(Configuration)' == 'Proto' OR '$(MonoPackaging)' == 'true')">false</EnableXlfLocalization>
<UpdateXlfOnBuild Condition="'$(CI)' != '1'">true</UpdateXlfOnBuild>
<EnableXlfLocalization Condition="'$(EnableXlfLocalization)' == '' AND ('$(Configuration)' == 'Proto' OR '$(MonoPackaging)' == 'true')">false</EnableXlfLocalization>
</PropertyGroup>

<!-- source build -->
Expand Down
10 changes: 9 additions & 1 deletion FSharpBuild.Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
</ItemGroup>
</Target>

<!-- SDK targets override -->
<PropertyGroup Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')">
<FSharpBuildAssemblyFileOverride>$(ProtoOutputPath)\fsc\FSharp.Build.dll</FSharpBuildAssemblyFileOverride>
</PropertyGroup>
<UsingTask TaskName="FSharpEmbedResourceText" AssemblyFile="$(FSharpBuildAssemblyFileOverride)" Override="true" Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')" />
<UsingTask TaskName="FSharpEmbedResXSource" AssemblyFile="$(FSharpBuildAssemblyFileOverride)" Override="true" Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')" />


<Target Name="BeforeResGen"
Inputs="@(EmbeddedResource->'$(IntermediateOutputPath)%(Filename)%(Extension)')"
Outputs="@(EmbeddedResource->'$(IntermediateOutputPath)resources\%(Filename)%(Extension)')"
Expand Down Expand Up @@ -146,7 +154,7 @@
Condition="'$(IsPackable)'=='true'">

<PropertyGroup>
<_GitUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), ".git$", ""))</_GitUrl>
<_GitUrl>https://github.com/dotnet/fsharp</_GitUrl>
<PackageReleaseNotes>$(_GitUrl)$(PackageReleaseNotes)</PackageReleaseNotes>
</PropertyGroup>
</Target>
Expand Down
Loading

0 comments on commit 1a8e11c

Please sign in to comment.